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
Modifier and TypeClassDescriptionstatic class
Builder pattern implementation building aTasksHandler
.static interface
TasksListener
is a generic interface listening tasks execution events.static class
Adapter class forTasksHandler.TasksListener
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTasksListener
(TasksHandler.TasksListener listener) Adds the tasks listener.static TasksHandler.Builder
builder()
Gets a new instance of aTasksHandler.Builder
which is used to build an instance of aTasksHandler
.void
Request to continue from an error.void
Request to fix current problems.Gets the internal state machine used by executing tasks.void
Mark all extended state variables related to tasks fixed.void
Removes the tasks listener.void
Resets state machine states from a backing persistent repository.void
runTasks()
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. IfStateMachinePersist
is not set this method doesn't do anything.StateMachine
is 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.Builder
which 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.
-