Class DurableBackgroundTasksProcessor
- java.lang.Object
-
- org.apache.ignite.internal.processors.GridProcessorAdapter
-
- org.apache.ignite.internal.processors.localtask.DurableBackgroundTasksProcessor
-
- All Implemented Interfaces:
GridComponent,CheckpointListener,MetastorageLifecycleListener,GridProcessor
public class DurableBackgroundTasksProcessor extends GridProcessorAdapter implements MetastorageLifecycleListener, CheckpointListener
Processor that is responsible for durable background tasks that are executed on local node.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointListener
CheckpointListener.Context
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent
GridComponent.DiscoveryDataExchangeType
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
ctx, diagnosticLog, log
-
-
Constructor Summary
Constructors Constructor Description DurableBackgroundTasksProcessor(GridKernalContext ctx)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterCheckpointEnd(CheckpointListener.Context ctx)Do some actions after checkpoint end.voidbeforeCheckpointBegin(CheckpointListener.Context ctx)Do some actions before checkpoint write lock.<R> IgniteInternalFuture<R>executeAsync(DurableBackgroundTask<R> task, boolean save)Asynchronous execution of a durable background task.<R> IgniteInternalFuture<R>executeAsync(DurableBackgroundTask<R> t, CacheConfiguration cacheCfg)Overloading theexecuteAsync(DurableBackgroundTask, boolean).voidonCheckpointBegin(CheckpointListener.Context ctx)voidonKernalStart(boolean active)Callback that notifies that kernal has successfully started, including all managers and processors.voidonKernalStop(boolean cancel)Callback to notify that kernal is about to stop.voidonMarkCheckpointBegin(CheckpointListener.Context ctx)voidonReadyForRead(ReadOnlyMetastorage metastorage)Is called when metastorage is made ready for read-only operations very early on node startup phase.voidonReadyForReadWrite(ReadWriteMetastorage metastorage)Fully functional metastore capable of performing reading and writing operations.voidonStateChangeFinish(ChangeGlobalStateFinishMessage msg)Callback on finish of a global state change.voidonStateChangeStarted(ChangeGlobalStateMessage msg)Callback at the start of a global state change.voidstart()Starts grid component.-
Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, onReconnected, printMemoryStats, stop, toString, validateNode, validateNode
-
-
-
-
Constructor Detail
-
DurableBackgroundTasksProcessor
public DurableBackgroundTasksProcessor(GridKernalContext ctx)
Constructor.- Parameters:
ctx- Kernal context.
-
-
Method Detail
-
start
public void start() throws IgniteCheckedExceptionStarts grid component.- Specified by:
startin interfaceGridComponent- Overrides:
startin classGridProcessorAdapter- Throws:
IgniteCheckedException- Throws in case of any errors.
-
onKernalStop
public void onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.- Specified by:
onKernalStopin interfaceGridComponent- Overrides:
onKernalStopin classGridProcessorAdapter- Parameters:
cancel- Flag indicating whether jobs should be canceled.
-
onReadyForRead
public void onReadyForRead(ReadOnlyMetastorage metastorage)
Is called when metastorage is made ready for read-only operations very early on node startup phase. Reference for read-only metastorage should be used only within this method and shouldn't be stored to any field.- Specified by:
onReadyForReadin interfaceMetastorageLifecycleListener- Parameters:
metastorage- Read-only meta storage.
-
onReadyForReadWrite
public void onReadyForReadWrite(ReadWriteMetastorage metastorage)
Fully functional metastore capable of performing reading and writing operations. Components interested in using metastore are allowed to keep reference passed into the method in their fields.- Specified by:
onReadyForReadWritein interfaceMetastorageLifecycleListener- Parameters:
metastorage- Fully functional meta storage.
-
beforeCheckpointBegin
public void beforeCheckpointBegin(CheckpointListener.Context ctx)
Do some actions before checkpoint write lock.- Specified by:
beforeCheckpointBeginin interfaceCheckpointListener
-
onMarkCheckpointBegin
public void onMarkCheckpointBegin(CheckpointListener.Context ctx)
- Specified by:
onMarkCheckpointBeginin interfaceCheckpointListener
-
onCheckpointBegin
public void onCheckpointBegin(CheckpointListener.Context ctx)
- Specified by:
onCheckpointBeginin interfaceCheckpointListener
-
afterCheckpointEnd
public void afterCheckpointEnd(CheckpointListener.Context ctx)
Do some actions after checkpoint end.- Specified by:
afterCheckpointEndin interfaceCheckpointListener
-
onStateChangeStarted
public void onStateChangeStarted(ChangeGlobalStateMessage msg)
Callback at the start of a global state change.- Parameters:
msg- Message for change cluster global state.
-
onStateChangeFinish
public void onStateChangeFinish(ChangeGlobalStateFinishMessage msg)
Callback on finish of a global state change.- Parameters:
msg- Finish message for change cluster global state.
-
onKernalStart
public void onKernalStart(boolean active) throws IgniteCheckedExceptionCallback that notifies that kernal has successfully started, including all managers and processors.- Specified by:
onKernalStartin interfaceGridComponent- Overrides:
onKernalStartin classGridProcessorAdapter- Parameters:
active- Cluster active flag (note: should be used carefully since state can change concurrently).- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
executeAsync
public <R> IgniteInternalFuture<R> executeAsync(DurableBackgroundTask<R> task, boolean save)
Asynchronous execution of a durable background task. A new task will be added for execution either if there is no task with the samenameor it (previous) will be completed. If the task is required to be completed after restarting the node, then it must be saved to the MetaStorage. If the task is saved to the Metastorage, then it will be deleted from it only after its completion and at the end of the checkpoint. Otherwise, it will be removed as soon as it is completed.- Parameters:
task- Durable background task.save- Save task to MetaStorage.- Returns:
- Futures that will complete when the task is completed.
-
executeAsync
public <R> IgniteInternalFuture<R> executeAsync(DurableBackgroundTask<R> t, CacheConfiguration cacheCfg)
Overloading theexecuteAsync(DurableBackgroundTask, boolean). If task is applied to persistent cache, saves it to MetaStorage.- Parameters:
t- Durable background task.cacheCfg- Cache configuration.- Returns:
- Futures that will complete when the task is completed.
-
-