Package org.elasticsearch.cluster
Class AckedClusterStateUpdateTask<Response>
- java.lang.Object
-
- org.elasticsearch.cluster.ClusterStateUpdateTask
-
- org.elasticsearch.cluster.AckedClusterStateUpdateTask<Response>
-
- All Implemented Interfaces:
AckedClusterStateTaskListener,ClusterStateTaskConfig,ClusterStateTaskExecutor<ClusterStateUpdateTask>,ClusterStateTaskListener
public abstract class AckedClusterStateUpdateTask<Response> extends ClusterStateUpdateTask implements AckedClusterStateTaskListener
An extension interface toClusterStateUpdateTaskthat allows to be notified when all the nodes have acknowledged a cluster state update request
-
-
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 Modifier Constructor Description protectedAckedClusterStateUpdateTask(AckedRequest request, ActionListener<Response> listener)protectedAckedClusterStateUpdateTask(Priority priority, AckedRequest request, ActionListener<Response> listener)
-
Method Summary
Modifier and Type Method Description TimeValueackTimeout()Acknowledgement timeout, maximum time interval to wait for acknowledgementsbooleanmustAck(DiscoveryNode discoveryNode)Called to determine which nodes the acknowledgement is expected fromprotected abstract ResponsenewResponse(boolean acknowledged)voidonAckTimeout()Called once the acknowledgement timeout defined byackTimeout()has expiredvoidonAllNodesAcked(java.lang.Exception e)Called once all the nodes have acknowledged the cluster state update request.voidonFailure(java.lang.String source, java.lang.Exception e)A callback called when execute fails.TimeValuetimeout()If the cluster state update task wasn't processed by the provided timeout, callClusterStateTaskListener.onFailure(String, Exception).-
Methods inherited from class org.elasticsearch.cluster.ClusterStateUpdateTask
clusterStatePublished, describeTasks, execute, execute, priority, runOnlyOnMaster
-
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.ClusterStateTaskListener
clusterStateProcessed, onNoLongerMaster
-
-
-
-
Constructor Detail
-
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(AckedRequest request, ActionListener<Response> listener)
-
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(Priority priority, AckedRequest request, ActionListener<Response> listener)
-
-
Method Detail
-
mustAck
public boolean mustAck(DiscoveryNode discoveryNode)
Called to determine which nodes the acknowledgement is expected from- Specified by:
mustAckin interfaceAckedClusterStateTaskListener- Parameters:
discoveryNode- a node- Returns:
- true if the node is expected to send ack back, false otherwise
-
onAllNodesAcked
public void onAllNodesAcked(@Nullable java.lang.Exception e)
Called once all the nodes have acknowledged the cluster state update request. Must be very lightweight execution, since it gets executed on the cluster service thread.- Specified by:
onAllNodesAckedin interfaceAckedClusterStateTaskListener- Parameters:
e- optional error that might have been thrown
-
newResponse
protected abstract Response newResponse(boolean acknowledged)
-
onAckTimeout
public void onAckTimeout()
Called once the acknowledgement timeout defined byackTimeout()has expired- Specified by:
onAckTimeoutin interfaceAckedClusterStateTaskListener
-
onFailure
public void onFailure(java.lang.String source, java.lang.Exception e)Description copied from class:ClusterStateUpdateTaskA callback called when execute fails.- Specified by:
onFailurein interfaceClusterStateTaskListener- Specified by:
onFailurein classClusterStateUpdateTask
-
ackTimeout
public TimeValue ackTimeout()
Acknowledgement timeout, maximum time interval to wait for acknowledgements- Specified by:
ackTimeoutin interfaceAckedClusterStateTaskListener
-
timeout
public TimeValue timeout()
Description copied from class:ClusterStateUpdateTaskIf the cluster state update task wasn't processed by the provided timeout, callClusterStateTaskListener.onFailure(String, Exception). May return null to indicate no timeout is needed (default).- Specified by:
timeoutin interfaceClusterStateTaskConfig- Overrides:
timeoutin classClusterStateUpdateTask- Returns:
- the timeout, or null if one is not set
-
-