Class TasksHandler
java.lang.Object
org.springframework.statemachine.recipes.tasks.TasksHandler
TasksHandler is a recipe for executing arbitrary Runnable tasks
using a state machine logic.
This recipe supports execution of multiple top-level tasks with a
sub-states construct of DAGs.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder pattern implementation building aTasksHandler.static interfaceTasksListeneris a generic interface listening tasks execution events.static classAdapter class forTasksHandler.TasksListener. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTasksListener(TasksHandler.TasksListener listener) Adds the tasks listener.static TasksHandler.Builderbuilder()Gets a new instance of aTasksHandler.Builderwhich is used to build an instance of aTasksHandler.voidRequest to continue from an error.voidRequest to fix current problems.Gets the internal state machine used by executing tasks.voidMark all extended state variables related to tasks fixed.voidRemoves the tasks listener.voidResets state machine states from a backing persistent repository.voidrunTasks()Request to execute current tasks logic.
-
Field Details
-
STATE_READY
- See Also:
-
STATE_FORK
- See Also:
-
STATE_TASKS
- See Also:
-
STATE_JOIN
- See Also:
-
STATE_CHOICE
- See Also:
-
STATE_ERROR
- See Also:
-
STATE_AUTOMATIC
- See Also:
-
STATE_MANUAL
- See Also:
-
STATE_TASKS_PREFIX
- See Also:
-
STATE_TASKS_INITIAL_POSTFIX
- See Also:
-
EVENT_RUN
- See Also:
-
EVENT_FALLBACK
- See Also:
-
EVENT_CONTINUE
- See Also:
-
EVENT_FIX
- See Also:
-
-
Method Details
-
runTasks
public void runTasks()Request to execute current tasks logic. -
continueFromError
public void continueFromError()Request to continue from an error. -
fixCurrentProblems
public void fixCurrentProblems()Request to fix current problems. -
resetFromPersistStore
public void resetFromPersistStore()Resets state machine states from a backing persistent repository. IfStateMachinePersistis not set this method doesn't do anything.StateMachineis stopped before states are reseted from a persistent store and started afterwards. -
addTasksListener
Adds the tasks listener.- Parameters:
listener- the listener
-
removeTasksListener
Removes the tasks listener.- Parameters:
listener- the listener
-
getStateMachine
Gets the internal state machine used by executing tasks.- Returns:
- the state machine
-
builder
Gets a new instance of aTasksHandler.Builderwhich is used to build an instance of aTasksHandler.- Returns:
- the tasks handler builder
-
markAllTasksFixed
public void markAllTasksFixed()Mark all extended state variables related to tasks fixed.
-