Package org.elasticsearch.discovery
Class BlockingClusterStatePublishResponseHandler
- java.lang.Object
-
- org.elasticsearch.discovery.BlockingClusterStatePublishResponseHandler
-
- Direct Known Subclasses:
AckClusterStatePublishResponseHandler
public class BlockingClusterStatePublishResponseHandler extends java.lang.Object
Handles responses obtained when publishing a new cluster state from master to all non master nodes. Allows to await a reply from all non master nodes, up to a timeout
-
-
Constructor Summary
Constructors Constructor Description BlockingClusterStatePublishResponseHandler(java.util.Set<DiscoveryNode> publishingToNodes)
Creates a new BlockingClusterStatePublishResponseHandler
-
Method Summary
Modifier and Type Method Description boolean
awaitAllNodes(TimeValue timeout)
Allows to wait for all non master nodes to reply to the publish event up to a timeoutjava.util.Set<DiscoveryNode>
getFailedNodes()
returns a set of nodes for which publication has failed.void
onFailure(DiscoveryNode node, java.lang.Exception e)
Called for each failure obtained from non master nodesvoid
onResponse(DiscoveryNode node)
Called for each response obtained from non master nodesDiscoveryNode[]
pendingNodes()
returns a list of nodes which didn't respond yet
-
-
-
Constructor Detail
-
BlockingClusterStatePublishResponseHandler
public BlockingClusterStatePublishResponseHandler(java.util.Set<DiscoveryNode> publishingToNodes)
Creates a new BlockingClusterStatePublishResponseHandler- Parameters:
publishingToNodes
- the set of nodes to which the cluster state will be published and should respond
-
-
Method Detail
-
onResponse
public void onResponse(DiscoveryNode node)
Called for each response obtained from non master nodes- Parameters:
node
- the node that replied to the publish event
-
onFailure
public void onFailure(DiscoveryNode node, java.lang.Exception e)
Called for each failure obtained from non master nodes- Parameters:
node
- the node that replied to the publish event
-
awaitAllNodes
public boolean awaitAllNodes(TimeValue timeout) throws java.lang.InterruptedException
Allows to wait for all non master nodes to reply to the publish event up to a timeout- Parameters:
timeout
- the timeout- Returns:
- true if the timeout expired or not, false otherwise
- Throws:
java.lang.InterruptedException
-
pendingNodes
public DiscoveryNode[] pendingNodes()
returns a list of nodes which didn't respond yet
-
getFailedNodes
public java.util.Set<DiscoveryNode> getFailedNodes()
returns a set of nodes for which publication has failed.
-
-