Module org.elasticsearch.server
Package org.elasticsearch.action.support
Enum Class ActiveShardsObserver
- All Implemented Interfaces:
Serializable
,Comparable<ActiveShardsObserver>
,Constable
This utility class provides a primitive for waiting for a configured number of shards
to become active before sending a response on an
ActionListener
.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Method Summary
Modifier and TypeMethodDescriptionstatic ActiveShardsObserver
Returns the enum constant of this class with the specified name.static ActiveShardsObserver[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.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
-
Method Details
-
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
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 nameNullPointerException
- 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 serviceindexNames
- the indices to wait for active shards onactiveShardCount
- the number of active shards to wait on before returningtimeout
- the timeout valuelistener
- listener to resolve withtrue
once the specified number of shards becomes available, resolve withfalse
on timeout or fail if an exception occurs
-