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 Action
callback
(Function<ActionResult, Action> callback) Create anAction
which causes thecallback
to be invoked.static Action
Create anAction
which indicates that an unrecoverable error has occurred and the scheduler must exit.static Action
Create anAction
which indicates that the scheduler has reached the end of its life cycle gracefullyObject[]
getType()
static Action
procedureCall
(Function<ActionResult, Action> callback, String procedure, Object... procedureParameters) Create anAction
which 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.ERROR
orActionType.EXIT
action then it will also be logged.toString()
-
Method Details
-
error
Create anAction
which indicates that an unrecoverable error has occurred and the scheduler must exit.statusMessage
is 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.ERROR
instance ofAction
-
exit
Create anAction
which indicates that the scheduler has reached the end of its life cycle gracefullystatusMessage
is 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.EXIT
instance ofAction
-
procedureCall
public static Action procedureCall(Function<ActionResult, Action> callback, String procedure, Object... procedureParameters) Create anAction
which 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.PROCEDURE
instance ofAction
-
callback
Create anAction
which causes thecallback
to be invoked. AnActionResult
will be associated with this call however it will have anull
procedure
andresult
.- Parameters:
callback
- To be invoked for this action- Returns:
- A new
ActionType.CALLBACK
instance ofAction
-
setStatusMessage
Set the optional status massage which will be reported in the statistics for a task and if this is anActionType.ERROR
orActionType.EXIT
action then it will also be logged. ForActionType.ERROR
orActionType.EXIT
actions 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
null
if the type of action is a stop action
-
toString
-
getType
- Returns:
- The
ActionType
of this action
-
getStatusMessage
- Returns:
- Optional status message provided with any action
-
getProcedure
- Returns:
- Name of procedure to execute. Will be
null
if this is not aActionType.PROCEDURE
-
getProcedureParameters
- Returns:
- The parameters that are to be passed the the procedure returned by
getProcedure()
-