ClusterStateListener
public class PersistentTasksClusterService extends AbstractComponent implements ClusterStateListener
deprecationLogger, logger, settings
Constructor | Description |
---|---|
PersistentTasksClusterService(Settings settings,
PersistentTasksExecutorRegistry registry,
ClusterService clusterService) |
Modifier and Type | Method | Description |
---|---|---|
void |
clusterChanged(ClusterChangedEvent event) |
Called when cluster state changes.
|
void |
completePersistentTask(java.lang.String id,
long allocationId,
java.lang.Exception failure,
ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener) |
Restarts a record about a running persistent task from cluster state
|
<Params extends PersistentTaskParams> |
createPersistentTask(java.lang.String taskId,
java.lang.String taskName,
Params taskParams,
ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener) |
Creates a new persistent task on master node
|
static boolean |
needsReassignment(PersistentTasksCustomMetaData.Assignment assignment,
DiscoveryNodes nodes) |
Returns true if the task is not assigned or is assigned to a non-existing node
|
void |
removePersistentTask(java.lang.String id,
ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener) |
Removes the persistent task
|
void |
updatePersistentTaskStatus(java.lang.String id,
long allocationId,
Task.Status status,
ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener) |
Update task status
|
logDeprecatedSetting, logRemovedSetting, nodeName
public PersistentTasksClusterService(Settings settings, PersistentTasksExecutorRegistry registry, ClusterService clusterService)
public <Params extends PersistentTaskParams> void createPersistentTask(java.lang.String taskId, java.lang.String taskName, Params taskParams, ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener)
taskId
- the task's idtaskName
- the task's nametaskParams
- the task's parameterslistener
- the listener that will be called when task is startedpublic void completePersistentTask(java.lang.String id, long allocationId, java.lang.Exception failure, ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener)
id
- the id of the persistent taskallocationId
- the allocation id of the persistent taskfailure
- the reason for restarting the task or null if the task completed successfullylistener
- the listener that will be called when task is removedpublic void removePersistentTask(java.lang.String id, ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener)
id
- the id of a persistent tasklistener
- the listener that will be called when task is removedpublic void updatePersistentTaskStatus(java.lang.String id, long allocationId, Task.Status status, ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener)
id
- the id of a persistent taskallocationId
- the expected allocation id of the persistent taskstatus
- new statuslistener
- the listener that will be called when task is removedpublic void clusterChanged(ClusterChangedEvent event)
ClusterStateListener
clusterChanged
in interface ClusterStateListener
public static boolean needsReassignment(PersistentTasksCustomMetaData.Assignment assignment, DiscoveryNodes nodes)