Package org.opensearch.tasks
Class TaskCancellationMonitoringService
java.lang.Object
org.opensearch.common.lifecycle.AbstractLifecycleComponent
org.opensearch.tasks.TaskCancellationMonitoringService
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.opensearch.common.lease.Releasable
,org.opensearch.common.lifecycle.LifecycleComponent
,TaskManager.TaskEventListeners
public class TaskCancellationMonitoringService
extends org.opensearch.common.lifecycle.AbstractLifecycleComponent
implements TaskManager.TaskEventListeners
This monitoring service is responsible to track long-running(defined by a threshold) cancelled tasks as part of
node stats.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Holds stats related to monitoring service -
Field Summary
Fields inherited from class org.opensearch.common.lifecycle.AbstractLifecycleComponent
lifecycle
-
Constructor Summary
ConstructorDescriptionTaskCancellationMonitoringService
(ThreadPool threadPool, TaskManager taskManager, TaskCancellationMonitoringSettings taskCancellationMonitoringSettings) -
Method Summary
Methods inherited from class org.opensearch.common.lifecycle.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
Constructor Details
-
TaskCancellationMonitoringService
public TaskCancellationMonitoringService(ThreadPool threadPool, TaskManager taskManager, TaskCancellationMonitoringSettings taskCancellationMonitoringSettings)
-
-
Method Details
-
doStart
protected void doStart()- Specified by:
doStart
in classorg.opensearch.common.lifecycle.AbstractLifecycleComponent
-
doStop
protected void doStop()- Specified by:
doStop
in classorg.opensearch.common.lifecycle.AbstractLifecycleComponent
-
doClose
- Specified by:
doClose
in classorg.opensearch.common.lifecycle.AbstractLifecycleComponent
- Throws:
IOException
-
getCancelledTaskTracker
-
onTaskCompleted
Invoked when a task is completed. This helps us to disable monitoring service when there are no cancelled tasks running to avoid wasteful work.- Specified by:
onTaskCompleted
in interfaceTaskManager.TaskEventListeners
- Parameters:
task
- task which got completed.
-
onTaskCancelled
Invoked when a task is cancelled. This is to keep track of tasks being cancelled. More importantly also helps us to enable this monitoring service only when needed.- Specified by:
onTaskCancelled
in interfaceTaskManager.TaskEventListeners
- Parameters:
task
- task which got cancelled.
-
stats
-