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 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
Constructors Modifier Constructor Description protected
AckedClusterStateUpdateTask(AckedRequest request, ActionListener<Response> listener)
protected
AckedClusterStateUpdateTask(Priority priority, AckedRequest request, ActionListener<Response> listener)
-
Method Summary
Modifier and Type Method Description TimeValue
ackTimeout()
Acknowledgement timeout, maximum time interval to wait for acknowledgementsboolean
mustAck(DiscoveryNode discoveryNode)
Called to determine which nodes the acknowledgement is expected fromprotected abstract Response
newResponse(boolean acknowledged)
void
onAckTimeout()
Called once the acknowledgement timeout defined byackTimeout()
has expiredvoid
onAllNodesAcked(java.lang.Exception e)
Called once all the nodes have acknowledged the cluster state update request.void
onFailure(java.lang.String source, java.lang.Exception e)
A callback called when execute fails.TimeValue
timeout()
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 Details
-
AckedClusterStateUpdateTask
-
AckedClusterStateUpdateTask
protected AckedClusterStateUpdateTask(Priority priority, AckedRequest request, ActionListener<Response> 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
public void onFailure(java.lang.String source, java.lang.Exception e)Description copied from class:ClusterStateUpdateTask
A callback called when execute fails.- Specified by:
onFailure
in interfaceClusterStateTaskListener
- Specified by:
onFailure
in classClusterStateUpdateTask
-
ackTimeout
Acknowledgement timeout, maximum time interval to wait for acknowledgements- Specified by:
ackTimeout
in interfaceAckedClusterStateTaskListener
-
timeout
Description copied from class:ClusterStateUpdateTask
If 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:
timeout
in interfaceClusterStateTaskConfig
- Overrides:
timeout
in classClusterStateUpdateTask
- Returns:
- the timeout, or null if one is not set
-