public class ClusterStateObserver
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ClusterStateObserver.ChangePredicate |
static class |
ClusterStateObserver.EventPredicate |
static interface |
ClusterStateObserver.Listener |
static class |
ClusterStateObserver.ValidationPredicate |
Modifier and Type | Field and Description |
---|---|
protected ESLogger |
logger |
ClusterStateObserver.ChangePredicate |
MATCH_ALL_CHANGES_PREDICATE |
Constructor and Description |
---|
ClusterStateObserver(ClusterService clusterService,
ESLogger logger,
ThreadContext contextHolder) |
ClusterStateObserver(ClusterService clusterService,
TimeValue timeout,
ESLogger logger,
ThreadContext contextHolder) |
Modifier and Type | Method and Description |
---|---|
boolean |
isTimedOut()
indicates whether this observer has timedout
|
ClusterState |
observedState()
last cluster state observer by this observer.
|
void |
reset(ClusterState toState)
reset this observer to the give cluster state.
|
void |
waitForNextChange(ClusterStateObserver.Listener listener) |
void |
waitForNextChange(ClusterStateObserver.Listener listener,
ClusterStateObserver.ChangePredicate changePredicate) |
void |
waitForNextChange(ClusterStateObserver.Listener listener,
ClusterStateObserver.ChangePredicate changePredicate,
TimeValue timeOutValue)
Wait for the next cluster state which satisfies changePredicate
|
void |
waitForNextChange(ClusterStateObserver.Listener listener,
TimeValue timeOutValue) |
protected final ESLogger logger
public final ClusterStateObserver.ChangePredicate MATCH_ALL_CHANGES_PREDICATE
public ClusterStateObserver(ClusterService clusterService, ESLogger logger, ThreadContext contextHolder)
public ClusterStateObserver(ClusterService clusterService, @Nullable TimeValue timeout, ESLogger 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 ClusterState observedState()
public boolean isTimedOut()
public void waitForNextChange(ClusterStateObserver.Listener listener)
public void waitForNextChange(ClusterStateObserver.Listener listener, @Nullable TimeValue timeOutValue)
public void waitForNextChange(ClusterStateObserver.Listener listener, ClusterStateObserver.ChangePredicate changePredicate)
public void waitForNextChange(ClusterStateObserver.Listener listener, ClusterStateObserver.ChangePredicate changePredicate, @Nullable TimeValue timeOutValue)
listener
- callback listenerchangePredicate
- 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.public void reset(ClusterState toState)