Package org.voltdb.task
Class Action
java.lang.Object
org.voltdb.task.Action
Class which defines an action to be taken as well as a callback to be invoked when that action has been performed.
There is no callback present if the type of action is a stop action.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Actioncallback(Function<ActionResult, Action> callback) Create anActionwhich causes thecallbackto be invoked.static ActionCreate anActionwhich indicates that an unrecoverable error has occurred and the scheduler must exit.static ActionCreate anActionwhich indicates that the scheduler has reached the end of its life cycle gracefullyObject[]getType()static ActionprocedureCall(Function<ActionResult, Action> callback, String procedure, Object... procedureParameters) Create anActionwhich executes a procedure with given parameterssetStatusMessage(String statusMessage) Set the optional status massage which will be reported in the statistics for a task and if this is anActionType.ERRORorActionType.EXITaction then it will also be logged.toString()
-
Method Details
-
error
Create anActionwhich indicates that an unrecoverable error has occurred and the scheduler must exit.statusMessageis the same status message which is set by callingsetStatusMessage(String)- Parameters:
statusMessage- To log indicating the details of the error. May benull- Returns:
- A new
ActionType.ERRORinstance ofAction
-
exit
Create anActionwhich indicates that the scheduler has reached the end of its life cycle gracefullystatusMessageis the same status message which is set by callingsetStatusMessage(String)- Parameters:
statusMessage- To log indicating the details of the error. May benull- Returns:
- A new
ActionType.EXITinstance ofAction
-
procedureCall
public static Action procedureCall(Function<ActionResult, Action> callback, String procedure, Object... procedureParameters) Create anActionwhich executes a procedure with given parameters- Parameters:
callback- To be invoked after this procedure is executedprocedure- Name of procedure to executeprocedureParameters- That are passed to procedure for execution- Returns:
- A new
ActionType.PROCEDUREinstance ofAction
-
callback
Create anActionwhich causes thecallbackto be invoked. AnActionResultwill be associated with this call however it will have anullprocedureandresult.- Parameters:
callback- To be invoked for this action- Returns:
- A new
ActionType.CALLBACKinstance ofAction
-
setStatusMessage
Set the optional status massage which will be reported in the statistics for a task and if this is anActionType.ERRORorActionType.EXITaction then it will also be logged. ForActionType.ERRORorActionType.EXITactions this can be provided as part of the factory method.- Parameters:
statusMessage- To be reported- Returns:
this
-
getCallback
- Returns:
- callback to be invoked after any provided procedure is executed. Will be
nullif the type of action is a stop action
-
toString
-
getType
- Returns:
- The
ActionTypeof this action
-
getStatusMessage
- Returns:
- Optional status message provided with any action
-
getProcedure
- Returns:
- Name of procedure to execute. Will be
nullif this is not aActionType.PROCEDURE
-
getProcedureParameters
- Returns:
- The parameters that are to be passed the the procedure returned by
getProcedure()
-