Class Action

java.lang.Object
org.voltdb.task.Action

public final class Action extends Object
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 Details

    • error

      public static Action error(String statusMessage)
      Create an Action which indicates that an unrecoverable error has occurred and the scheduler must exit.

      statusMessage is the same status message which is set by calling setStatusMessage(String)

      Parameters:
      statusMessage - To log indicating the details of the error. May be null
      Returns:
      A new ActionType.ERROR instance of Action
    • exit

      public static Action exit(String statusMessage)
      Create an Action which indicates that the scheduler has reached the end of its life cycle gracefully

      statusMessage is the same status message which is set by calling setStatusMessage(String)

      Parameters:
      statusMessage - To log indicating the details of the error. May be null
      Returns:
      A new ActionType.EXIT instance of Action
    • procedureCall

      public static Action procedureCall(Function<ActionResult,Action> callback, String procedure, Object... procedureParameters)
      Create an Action which executes a procedure with given parameters
      Parameters:
      callback - To be invoked after this procedure is executed
      procedure - Name of procedure to execute
      procedureParameters - That are passed to procedure for execution
      Returns:
      A new ActionType.PROCEDURE instance of Action
    • callback

      public static Action callback(Function<ActionResult,Action> callback)
      Create an Action which causes the callback to be invoked. An ActionResult will be associated with this call however it will have a null procedure and result.
      Parameters:
      callback - To be invoked for this action
      Returns:
      A new ActionType.CALLBACK instance of Action
    • setStatusMessage

      public Action setStatusMessage(String statusMessage)
      Set the optional status massage which will be reported in the statistics for a task and if this is an ActionType.ERROR or ActionType.EXIT action then it will also be logged. For ActionType.ERROR or ActionType.EXIT actions this can be provided as part of the factory method.
      Parameters:
      statusMessage - To be reported
      Returns:
      this
    • getCallback

      public Function<ActionResult,Action> 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

      public String toString()
    • getType

      public ActionType getType()
      Returns:
      The ActionType of this action
    • getStatusMessage

      public String getStatusMessage()
      Returns:
      Optional status message provided with any action
    • getProcedure

      public String getProcedure()
      Returns:
      Name of procedure to execute. Will be null if this is not a ActionType.PROCEDURE
    • getProcedureParameters

      public Object[] getProcedureParameters()
      Returns:
      The parameters that are to be passed the the procedure returned by getProcedure()