Class BlockingClusterStatePublishResponseHandler

java.lang.Object
org.elasticsearch.discovery.BlockingClusterStatePublishResponseHandler
Direct Known Subclasses:
AckClusterStatePublishResponseHandler

public class BlockingClusterStatePublishResponseHandler extends 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 Details

    • BlockingClusterStatePublishResponseHandler

      public BlockingClusterStatePublishResponseHandler(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 Details

    • 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, 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(org.elasticsearch.core.TimeValue timeout) throws 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:
      InterruptedException
    • pendingNodes

      public DiscoveryNode[] pendingNodes()
      returns a list of nodes which didn't respond yet
    • getFailedNodes

      public Set<DiscoveryNode> getFailedNodes()
      returns a set of nodes for which publication has failed.