public class ClusterStateObserver
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static interface |
ClusterStateObserver.Listener |
Modifier and Type | Field | Description |
---|---|---|
protected org.apache.logging.log4j.Logger |
logger |
Constructor | Description |
---|---|
ClusterStateObserver(ClusterState initialState,
ClusterApplierService clusterApplierService,
TimeValue timeout,
org.apache.logging.log4j.Logger logger,
ThreadContext contextHolder) |
|
ClusterStateObserver(ClusterState initialState,
ClusterService clusterService,
TimeValue timeout,
org.apache.logging.log4j.Logger logger,
ThreadContext contextHolder) |
|
ClusterStateObserver(ClusterService clusterService,
org.apache.logging.log4j.Logger logger,
ThreadContext contextHolder) |
|
ClusterStateObserver(ClusterService clusterService,
TimeValue timeout,
org.apache.logging.log4j.Logger logger,
ThreadContext contextHolder) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
isTimedOut() |
indicates whether this observer has timed out
|
ClusterState |
setAndGetObservedState() |
sets the last observed state to the currently applied cluster state and returns it
|
void |
waitForNextChange(ClusterStateObserver.Listener listener) |
|
void |
waitForNextChange(ClusterStateObserver.Listener listener,
java.util.function.Predicate<ClusterState> statePredicate) |
|
void |
waitForNextChange(ClusterStateObserver.Listener listener,
java.util.function.Predicate<ClusterState> statePredicate,
TimeValue timeOutValue) |
Wait for the next cluster state which satisfies statePredicate
|
void |
waitForNextChange(ClusterStateObserver.Listener listener,
TimeValue timeOutValue) |
public ClusterStateObserver(ClusterService clusterService, org.apache.logging.log4j.Logger logger, ThreadContext contextHolder)
public ClusterStateObserver(ClusterService clusterService, @Nullable TimeValue timeout, org.apache.logging.log4j.Logger logger, ThreadContext contextHolder)
timeout
- a global timeout for this observer. After it has expired the observer
will fail any existing or new #waitForNextChange calls. Set to null
to wait indefinitelypublic ClusterStateObserver(ClusterState initialState, ClusterService clusterService, @Nullable TimeValue timeout, org.apache.logging.log4j.Logger logger, ThreadContext contextHolder)
timeout
- a global timeout for this observer. After it has expired the observer
will fail any existing or new #waitForNextChange calls. Set to null
to wait indefinitelypublic ClusterStateObserver(ClusterState initialState, ClusterApplierService clusterApplierService, @Nullable TimeValue timeout, org.apache.logging.log4j.Logger logger, ThreadContext contextHolder)
public ClusterState setAndGetObservedState()
public boolean isTimedOut()
public void waitForNextChange(ClusterStateObserver.Listener listener)
public void waitForNextChange(ClusterStateObserver.Listener listener, @Nullable TimeValue timeOutValue)
public void waitForNextChange(ClusterStateObserver.Listener listener, java.util.function.Predicate<ClusterState> statePredicate)
public void waitForNextChange(ClusterStateObserver.Listener listener, java.util.function.Predicate<ClusterState> statePredicate, @Nullable TimeValue timeOutValue)
listener
- callback listenerstatePredicate
- predicate to check whether cluster state changes are relevant and the callback should be calledtimeOutValue
- a timeout for waiting. If null the global observer timeout will be used.