Package org.elasticsearch.cluster
Class LocalClusterUpdateTask
java.lang.Object
org.elasticsearch.cluster.LocalClusterUpdateTask
- All Implemented Interfaces:
ClusterStateTaskConfig
,ClusterStateTaskExecutor<LocalClusterUpdateTask>
,ClusterStateTaskListener
public abstract class LocalClusterUpdateTask extends java.lang.Object implements ClusterStateTaskConfig, ClusterStateTaskExecutor<LocalClusterUpdateTask>, ClusterStateTaskListener
Used to apply state updates on nodes that are not necessarily master
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.ClusterStateTaskConfig
ClusterStateTaskConfig.Basic
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.ClusterStateTaskExecutor
ClusterStateTaskExecutor.ClusterTasksResult<T>, ClusterStateTaskExecutor.TaskResult
-
Constructor Summary
Constructors Constructor Description LocalClusterUpdateTask()
LocalClusterUpdateTask(Priority priority)
-
Method Summary
Modifier and Type Method Description java.lang.String
describeTasks(java.util.List<LocalClusterUpdateTask> tasks)
Builds a concise description of a list of tasks (to be used in logging etc.).abstract ClusterStateTaskExecutor.ClusterTasksResult<LocalClusterUpdateTask>
execute(ClusterState currentState)
ClusterStateTaskExecutor.ClusterTasksResult<LocalClusterUpdateTask>
execute(ClusterState currentState, java.util.List<LocalClusterUpdateTask> tasks)
Update the cluster state based on the current state and the given tasks.Priority
priority()
ThePriority
for this cluster state update task configuration.boolean
runOnlyOnMaster()
indicates whether this executor should only run if the current node is masterorg.elasticsearch.common.unit.TimeValue
timeout()
The timeout for this cluster state update task configuration.static ClusterStateTaskExecutor.ClusterTasksResult<LocalClusterUpdateTask>
unchanged()
no changes were made to the cluster state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.cluster.ClusterStateTaskExecutor
clusterStatePublished
Methods inherited from interface org.elasticsearch.cluster.ClusterStateTaskListener
clusterStateProcessed, onFailure, onNoLongerMaster
-
Constructor Details
-
LocalClusterUpdateTask
public LocalClusterUpdateTask() -
LocalClusterUpdateTask
-
-
Method Details
-
execute
public abstract ClusterStateTaskExecutor.ClusterTasksResult<LocalClusterUpdateTask> execute(ClusterState currentState) throws java.lang.Exception- Throws:
java.lang.Exception
-
execute
public final ClusterStateTaskExecutor.ClusterTasksResult<LocalClusterUpdateTask> execute(ClusterState currentState, java.util.List<LocalClusterUpdateTask> tasks) throws java.lang.ExceptionDescription copied from interface:ClusterStateTaskExecutor
Update the cluster state based on the current state and the given tasks. Return the *same instance* if no state should be changed.- Specified by:
execute
in interfaceClusterStateTaskExecutor<LocalClusterUpdateTask>
- Throws:
java.lang.Exception
-
unchanged
no changes were made to the cluster state. Useful to execute a runnable on the cluster state applier thread -
describeTasks
Description copied from interface:ClusterStateTaskExecutor
Builds a concise description of a list of tasks (to be used in logging etc.). Note that the tasks given are not necessarily the same as those that will be passed toClusterStateTaskExecutor.execute(ClusterState, List)
. but are guaranteed to be a subset of them. This method can be called multiple times with different lists before execution. This allows groupd task description but the submitting source.- Specified by:
describeTasks
in interfaceClusterStateTaskExecutor<LocalClusterUpdateTask>
-
timeout
@Nullable public org.elasticsearch.common.unit.TimeValue timeout()Description copied from interface:ClusterStateTaskConfig
The timeout for this cluster state update task configuration. If the cluster state update task isn't processed within this timeout, the associatedClusterStateTaskListener.onFailure(String, Exception)
is invoked.- Specified by:
timeout
in interfaceClusterStateTaskConfig
- Returns:
- the timeout, or null if one is not set
-
priority
Description copied from interface:ClusterStateTaskConfig
ThePriority
for this cluster state update task configuration.- Specified by:
priority
in interfaceClusterStateTaskConfig
- Returns:
- the priority
-
runOnlyOnMaster
public final boolean runOnlyOnMaster()Description copied from interface:ClusterStateTaskExecutor
indicates whether this executor should only run if the current node is master- Specified by:
runOnlyOnMaster
in interfaceClusterStateTaskExecutor<LocalClusterUpdateTask>
-