public class TasksHandler
extends java.lang.Object
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.Modifier and Type | Class and Description |
---|---|
static class |
TasksHandler.Builder
Builder pattern implementation building a
TasksHandler . |
static interface |
TasksHandler.TasksListener
TasksListener is a generic interface listening tasks
execution events. |
static class |
TasksHandler.TasksListenerAdapter
Adapter class for
TasksHandler.TasksListener . |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EVENT_CONTINUE |
static java.lang.String |
EVENT_FALLBACK |
static java.lang.String |
EVENT_FIX |
static java.lang.String |
EVENT_RUN |
static java.lang.String |
STATE_AUTOMATIC |
static java.lang.String |
STATE_CHOICE |
static java.lang.String |
STATE_ERROR |
static java.lang.String |
STATE_FORK |
static java.lang.String |
STATE_JOIN |
static java.lang.String |
STATE_MANUAL |
static java.lang.String |
STATE_READY |
static java.lang.String |
STATE_TASKS |
static java.lang.String |
STATE_TASKS_INITIAL_POSTFIX |
static java.lang.String |
STATE_TASKS_PREFIX |
Modifier and Type | Method and Description |
---|---|
void |
addTasksListener(TasksHandler.TasksListener listener)
Adds the tasks listener.
|
static TasksHandler.Builder |
builder()
Gets a new instance of a
TasksHandler.Builder which is used to build
an instance of a TasksHandler . |
void |
continueFromError()
Request to continue from an error.
|
void |
fixCurrentProblems()
Request to fix current problems.
|
StateMachine<java.lang.String,java.lang.String> |
getStateMachine()
Gets the internal state machine used by executing tasks.
|
void |
markAllTasksFixed()
Mark all extended state variables related to tasks fixed.
|
void |
removeTasksListener(TasksHandler.TasksListener listener)
Removes the tasks listener.
|
void |
resetFromPersistStore()
Resets state machine states from a backing persistent repository.
|
void |
runTasks()
Request to execute current tasks logic.
|
public static final java.lang.String STATE_READY
public static final java.lang.String STATE_FORK
public static final java.lang.String STATE_TASKS
public static final java.lang.String STATE_JOIN
public static final java.lang.String STATE_CHOICE
public static final java.lang.String STATE_ERROR
public static final java.lang.String STATE_AUTOMATIC
public static final java.lang.String STATE_MANUAL
public static final java.lang.String STATE_TASKS_PREFIX
public static final java.lang.String STATE_TASKS_INITIAL_POSTFIX
public static final java.lang.String EVENT_RUN
public static final java.lang.String EVENT_FALLBACK
public static final java.lang.String EVENT_CONTINUE
public static final java.lang.String EVENT_FIX
public void runTasks()
public void continueFromError()
public void fixCurrentProblems()
public void resetFromPersistStore()
StateMachinePersist
is not set this method doesn't do anything.
StateMachine
is stopped before states are reseted from a persistent
store and started afterwards.public void addTasksListener(TasksHandler.TasksListener listener)
listener
- the listenerpublic void removeTasksListener(TasksHandler.TasksListener listener)
listener
- the listenerpublic StateMachine<java.lang.String,java.lang.String> getStateMachine()
public static TasksHandler.Builder builder()
TasksHandler.Builder
which is used to build
an instance of a TasksHandler
.public void markAllTasksFixed()