java.lang.Object
org.elasticsearch.cluster.SafeClusterStateSupplier
- All Implemented Interfaces:
Supplier<Optional<ClusterState>>
,ClusterStateListener
,ClusterStateSupplier
public class SafeClusterStateSupplier
extends Object
implements ClusterStateSupplier, ClusterStateListener
Utility to access
ClusterState
only when it is "ready", where "ready" means that we received a first clusterChanged event
with no global block of type STATE_NOT_RECOVERED_BLOCK
This guarantees that:
- the initial cluster state has been set (see
ClusterApplierService.setInitialState(ClusterState)
);
- the initial recovery process has completed.-
Constructor Details
-
SafeClusterStateSupplier
public SafeClusterStateSupplier()
-
-
Method Details
-
clusterChanged
Description copied from interface:ClusterStateListener
Called when cluster state changes.Cluster states are applied one-by-one which means they can be a performance bottleneck. Implementations of this method should therefore be fast, so please consider forking work into the background rather than doing everything inline.
- Specified by:
clusterChanged
in interfaceClusterStateListener
-
get
- Specified by:
get
in interfaceSupplier<Optional<ClusterState>>
-