Class DefaultTaskController<InputT,OutputT>
java.lang.Object
io.aleph0.yap.core.task.DefaultTaskController<InputT,OutputT>
- All Implemented Interfaces:
TaskController
- Direct Known Subclasses:
DefaultConsumerTaskController,DefaultProcessorTaskController,DefaultProducerTaskController
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe phase of the task.static enumThe internal state of a task.Nested classes/interfaces inherited from interface io.aleph0.yap.core.task.TaskController
TaskController.ConsumerTaskControllerBuilder<InputT>, TaskController.ProcessorTaskControllerBuilder<InputT,OutputT>, TaskController.ProducerTaskControllerBuilder<OutputT> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe maximum amount of time to wait for a lifecycle event, after whichTaskController.onHeartbeat()will be called.Called when the user has requested to cancel this task.Called when no lifecycle events have occurred withinthe heartbeat interval.voidCalled when the task has been cancelled.voidCalled when the task has failed.Called when a task has been started.voidCalled when the task has been successfully completed.onWorkerCompletedExceptionally(int id, Throwable error) Called when a worker completed exceptionally by propagating an exception.onWorkerCompletedNormally(int id) Called when a worker completed normally, for example because all input messages were processed.onWorkerStarted(int id) Called when a worker was started successfully in response to a start request.onWorkerStopped(int id) Called when a worker was stopped in response to a stop request.
-
Constructor Details
-
DefaultTaskController
-
-
Method Details
-
onTaskStart
Description copied from interface:TaskControllerCalled when a task has been started. Called as the first event only.- Specified by:
onTaskStartin interfaceTaskController- Returns:
- the next actions to perform
-
onWorkerStarted
Description copied from interface:TaskControllerCalled when a worker was started successfully in response to a start request.- Specified by:
onWorkerStartedin interfaceTaskController- Parameters:
id- the id of the worker that was started- Returns:
- the next actions to perform
- See Also:
-
onWorkerCompletedNormally
Description copied from interface:TaskControllerCalled when a worker completed normally, for example because all input messages were processed.- Specified by:
onWorkerCompletedNormallyin interfaceTaskController- Parameters:
id- the id of the worker that completed- Returns:
- the next action to perform
-
onWorkerStopped
Description copied from interface:TaskControllerCalled when a worker was stopped in response to a stop request.- Specified by:
onWorkerStoppedin interfaceTaskController- Parameters:
id- the id of the worker that was stopped- Returns:
- the next action to perform
- See Also:
-
onWorkerCompletedExceptionally
Description copied from interface:TaskControllerCalled when a worker completed exceptionally by propagating an exception.- Specified by:
onWorkerCompletedExceptionallyin interfaceTaskController- Parameters:
id- the id of the worker that completederror- the exception that caused the worker to complete exceptionally- Returns:
- the next action to perform
-
onCancelRequested
Description copied from interface:TaskControllerCalled when the user has requested to cancel this task. In general, this means that the controller should stop all running workers and finish the task with an appropriate status as soon as possible.- Specified by:
onCancelRequestedin interfaceTaskController- Returns:
- the next action to perform
- See Also:
-
onHeartbeat
Description copied from interface:TaskControllerCalled when no lifecycle events have occurred withinthe heartbeat interval. This ensures that the controller has periodic access to execute actions even if no lifecycle events are occurring, for example to start more workers in response to a backlog of messages, or stop workers in response to no backlog.- Specified by:
onHeartbeatin interfaceTaskController- Returns:
- the next action to perform
-
onTaskSucceeded
public void onTaskSucceeded()Description copied from interface:TaskControllerCalled when the task has been successfully completed. This is the last event that will be called.- Specified by:
onTaskSucceededin interfaceTaskController
-
onTaskCancelled
public void onTaskCancelled()Description copied from interface:TaskControllerCalled when the task has been cancelled. This is the last event that will be called.- Specified by:
onTaskCancelledin interfaceTaskController
-
onTaskFailed
Description copied from interface:TaskControllerCalled when the task has failed. This is the last event that will be called.- Specified by:
onTaskFailedin interfaceTaskController- Parameters:
e- the exception that caused the task to fail
-
getHeartbeatInterval
Description copied from interface:TaskControllerThe maximum amount of time to wait for a lifecycle event, after whichTaskController.onHeartbeat()will be called.- Specified by:
getHeartbeatIntervalin interfaceTaskController
-