Package org.elasticsearch.cluster
Class AckedClusterStateUpdateTask
java.lang.Object
org.elasticsearch.cluster.ClusterStateUpdateTask
org.elasticsearch.cluster.AckedClusterStateUpdateTask
- All Implemented Interfaces:
AckedClusterStateTaskListener
,ClusterStateTaskConfig
,ClusterStateTaskExecutor<ClusterStateUpdateTask>
,ClusterStateTaskListener
public abstract class AckedClusterStateUpdateTask
extends ClusterStateUpdateTask
implements AckedClusterStateTaskListener
An extension interface to
ClusterStateUpdateTask
that 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
ModifierConstructorDescriptionprotected
AckedClusterStateUpdateTask(AckedRequest request, ActionListener<? extends AcknowledgedResponse> listener)
protected
AckedClusterStateUpdateTask(Priority priority, AckedRequest request, ActionListener<? extends AcknowledgedResponse> listener)
-
Method Summary
Modifier and TypeMethodDescriptionorg.elasticsearch.core.TimeValue
Acknowledgement timeout, maximum time interval to wait for acknowledgementsboolean
mustAck(DiscoveryNode discoveryNode)
Called to determine which nodes the acknowledgement is expected fromprotected AcknowledgedResponse
newResponse(boolean acknowledged)
void
Called once the acknowledgement timeout defined byackTimeout()
has expiredvoid
Called once all the nodes have acknowledged the cluster state update request.void
A callback for when task execution fails.Methods inherited from class org.elasticsearch.cluster.ClusterStateUpdateTask
clusterStatePublished, describeTasks, execute, execute, priority, runOnlyOnMaster, timeout
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 Details
-
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(AckedRequest request, ActionListener<? extends AcknowledgedResponse> listener) -
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(Priority priority, AckedRequest request, ActionListener<? extends AcknowledgedResponse> listener)
-
-
Method Details
-
mustAck
Called to determine which nodes the acknowledgement is expected from- Specified by:
mustAck
in interfaceAckedClusterStateTaskListener
- Parameters:
discoveryNode
- a node- Returns:
- true if the node is expected to send ack back, false otherwise
-
onAllNodesAcked
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:
onAllNodesAcked
in interfaceAckedClusterStateTaskListener
- 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:
onAckTimeout
in interfaceAckedClusterStateTaskListener
-
onFailure
Description copied from class:ClusterStateUpdateTask
A callback for when task execution fails. Implementations of this callback should not throw exceptions: an exception thrown here is logged by the master service atERROR
level and otherwise ignored. If log-and-ignore is the right behaviour then implementations should do so themselves, typically using a more specific logger and at a less dramatic log level.- Specified by:
onFailure
in interfaceClusterStateTaskListener
- Specified by:
onFailure
in classClusterStateUpdateTask
-
ackTimeout
public final org.elasticsearch.core.TimeValue ackTimeout()Acknowledgement timeout, maximum time interval to wait for acknowledgements- Specified by:
ackTimeout
in interfaceAckedClusterStateTaskListener
-