java.lang.Object
org.elasticsearch.cluster.InternalClusterInfoService
- All Implemented Interfaces:
ClusterInfoService,ClusterStateListener
public class InternalClusterInfoService
extends Object
implements ClusterInfoService, ClusterStateListener
InternalClusterInfoService provides the ClusterInfoService interface,
routinely updated on a timer. The timer can be dynamically changed by
setting the
cluster.info.update.interval setting (defaulting
to 30 seconds). The InternalClusterInfoService only runs on the master node.
Listens for changes in the number of data nodes and immediately submits a
ClusterInfoUpdateJob if a node has been added.
Every time the timer runs, if cluster.routing.allocation.disk.threshold_enabled
is enabled, gathers information about the disk usage and shard sizes across the cluster,
computes a new cluster info and notifies the registered listeners. If disk threshold
monitoring is disabled, listeners are called with an empty cluster info.-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionInternalClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, Client client, EstimatedHeapUsageCollector estimatedHeapUsageCollector, NodeUsageStatsForThreadPoolsCollector nodeUsageStatsForThreadPoolsCollector) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(Consumer<ClusterInfo> clusterInfoConsumer) Add a listener for new cluster informationvoidCalled when cluster state changes.
-
Field Details
-
INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING
-
INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING
-
CLUSTER_ROUTING_ALLOCATION_ESTIMATED_HEAP_THRESHOLD_DECIDER_ENABLED
-
-
Constructor Details
-
InternalClusterInfoService
public InternalClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, Client client, EstimatedHeapUsageCollector estimatedHeapUsageCollector, NodeUsageStatsForThreadPoolsCollector nodeUsageStatsForThreadPoolsCollector)
-
-
Method Details
-
clusterChanged
Description copied from interface:ClusterStateListenerCalled 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:
clusterChangedin interfaceClusterStateListener
-
getClusterInfo
- Specified by:
getClusterInfoin interfaceClusterInfoService- Returns:
- the latest cluster information
-
addListener
Description copied from interface:ClusterInfoServiceAdd a listener for new cluster information- Specified by:
addListenerin interfaceClusterInfoService
-