java.lang.Object
org.elasticsearch.cluster.ClusterStateUpdateTask
org.elasticsearch.cluster.AckedClusterStateUpdateTask
- All Implemented Interfaces:
 ClusterStateAckListener,ClusterStateTaskListener
- Direct Known Subclasses:
 RepositoriesService.RegisterRepositoryTask,RepositoriesService.UnregisterRepositoryTask
public abstract class AckedClusterStateUpdateTask
extends ClusterStateUpdateTask
implements ClusterStateAckListener
An extension interface to 
ClusterStateUpdateTask that allows the caller to be notified after the master has
 computed, published, accepted, committed, and applied the cluster state update AND only after the rest of the nodes
 (or a specified subset) have also accepted and applied the cluster state update.- 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAckedClusterStateUpdateTask(AcknowledgedRequest<?> request, ActionListener<? extends AcknowledgedResponse> listener) protectedAckedClusterStateUpdateTask(Priority priority, AcknowledgedRequest<?> request, ActionListener<? extends AcknowledgedResponse> listener) protectedAckedClusterStateUpdateTask(Priority priority, TimeValue masterNodeTimeout, TimeValue ackTimeout, ActionListener<? extends AcknowledgedResponse> listener) protectedAckedClusterStateUpdateTask(TimeValue masterNodeTimeout, TimeValue ackTimeout, ActionListener<? extends AcknowledgedResponse> listener)  - 
Method Summary
Modifier and TypeMethodDescriptionfinal TimeValueAcknowledgement timeout, maximum time interval to wait for acknowledgementsbooleanmustAck(DiscoveryNode discoveryNode) Called to determine which nodes the acknowledgement is expected fromprotected AcknowledgedResponsenewResponse(boolean acknowledged) voidCalled after all the nodes have acknowledged the cluster state update request but at least one of them failed.voidCalled once the acknowledgement timeout defined byackTimeout()has expiredvoidCalled once all the nodes have acknowledged the cluster state update request.voidA callback for when task execution fails.Methods inherited from class org.elasticsearch.cluster.ClusterStateUpdateTask
clusterStateProcessed, execute, priority, timeout 
- 
Constructor Details
- 
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(AcknowledgedRequest<?> request, ActionListener<? extends AcknowledgedResponse> listener)  - 
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(TimeValue masterNodeTimeout, TimeValue ackTimeout, ActionListener<? extends AcknowledgedResponse> listener)  - 
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(Priority priority, AcknowledgedRequest<?> request, ActionListener<? extends AcknowledgedResponse> listener)  - 
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(Priority priority, TimeValue masterNodeTimeout, TimeValue ackTimeout, ActionListener<? extends AcknowledgedResponse> listener)  
 - 
 - 
Method Details
- 
mustAck
Called to determine which nodes the acknowledgement is expected from- Specified by:
 mustAckin interfaceClusterStateAckListener- Parameters:
 discoveryNode- a node- Returns:
 - true if the node is expected to send ack back, false otherwise
 
 - 
onAllNodesAcked
public void onAllNodesAcked()Description copied from interface:ClusterStateAckListenerCalled 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 interfaceClusterStateAckListener
 - 
onAckFailure
Description copied from interface:ClusterStateAckListenerCalled after all the nodes have acknowledged the cluster state update request but at least one of them failed. Must be very lightweight execution, since it gets executed on the cluster service thread.- Specified by:
 onAckFailurein interfaceClusterStateAckListener- Parameters:
 e- optional error that might have been thrown
 - 
newResponse
 - 
onAckTimeout
public void onAckTimeout()Called once the acknowledgement timeout defined byackTimeout()has expired- Specified by:
 onAckTimeoutin interfaceClusterStateAckListener
 - 
onFailure
Description copied from interface:ClusterStateTaskListenerA callback for when task execution fails. May receive aNotMasterExceptionif this node stopped being the master before this task was executed or aProcessClusterEventTimeoutExceptionif the task timed out before it was executed. If the task fails during execution then this method receives the corresponding exception. If the task executes successfully but the resulting cluster state publication fails then this method receives aFailedToCommitClusterStateException. If publication fails then a new master is elected and the update might or might not take effect, depending on whether or not the newly-elected master accepted the published state that failed to be committed.Use
MasterService.isPublishFailureException(java.lang.Exception)to detect the "expected" master failure cases if needed.Implementations of this callback must not throw exceptions: an exception thrown here is logged by the master service at
ERRORlevel and otherwise ignored, except in tests where it raises anAssertionError. If log-and-ignore is the right behaviour then implementations must do so themselves, typically using a more specific logger and at a less dramatic log level.- Specified by:
 onFailurein interfaceClusterStateTaskListener
 - 
ackTimeout
Acknowledgement timeout, maximum time interval to wait for acknowledgements- Specified by:
 ackTimeoutin interfaceClusterStateAckListener- Returns:
 - acknowledgement timeout, maximum time interval to wait for acknowledgements
 
 
 -