Enum Class ActiveShardsObserver

java.lang.Object
java.lang.Enum<ActiveShardsObserver>
org.elasticsearch.action.support.ActiveShardsObserver
All Implemented Interfaces:
Serializable, Comparable<ActiveShardsObserver>, Constable

public enum ActiveShardsObserver extends Enum<ActiveShardsObserver>
This utility class provides a primitive for waiting for a configured number of shards to become active before sending a response on an ActionListener.
  • Method Details

    • values

      public static ActiveShardsObserver[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ActiveShardsObserver valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • waitForActiveShards

      public static void waitForActiveShards(ClusterService clusterService, String[] indexNames, ActiveShardCount activeShardCount, TimeValue timeout, ActionListener<Boolean> listener)
      Waits on the specified number of active shards to be started
      Parameters:
      clusterService - cluster service
      indexNames - the indices to wait for active shards on
      activeShardCount - the number of active shards to wait on before returning
      timeout - the timeout value
      listener - listener to resolve with true once the specified number of shards becomes available, resolve with false on timeout or fail if an exception occurs