Package org.elasticsearch.action.support
Class ActiveShardsObserver
- java.lang.Object
-
- org.elasticsearch.action.support.ActiveShardsObserver
-
public class ActiveShardsObserver extends Object
This class provides primitives for waiting for a configured number of shards to become active before sending a response on anActionListener.
-
-
Constructor Summary
Constructors Constructor Description ActiveShardsObserver(ClusterService clusterService, ThreadPool threadPool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwaitForActiveShards(String[] indexNames, ActiveShardCount activeShardCount, TimeValue timeout, Consumer<Boolean> onResult, Consumer<Exception> onFailure)Waits on the specified number of active shards to be started before executing the
-
-
-
Constructor Detail
-
ActiveShardsObserver
public ActiveShardsObserver(ClusterService clusterService, ThreadPool threadPool)
-
-
Method Detail
-
waitForActiveShards
public void waitForActiveShards(String[] indexNames, ActiveShardCount activeShardCount, TimeValue timeout, Consumer<Boolean> onResult, Consumer<Exception> onFailure)
Waits on the specified number of active shards to be started before executing the- Parameters:
indexNames- the indices to wait for active shards onactiveShardCount- the number of active shards to wait on before returningtimeout- the timeout valueonResult- a function that is executed in response to the requisite shards becoming active or a timeout (whichever comes first)onFailure- a function that is executed in response to an error occurring during waiting for the active shards
-
-