public class InternalClusterInfoService extends AbstractComponent implements ClusterInfoService, LocalNodeMasterListener, ClusterStateListener
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, gathers information about the disk usage and
shard sizes across the cluster.Modifier and Type | Class and Description |
---|---|
class |
InternalClusterInfoService.SubmitReschedulingClusterInfoUpdatedJob
Class used to submit
maybeRefresh() on the
InternalClusterInfoService threadpool, these jobs will
reschedule themselves by placing a new instance of this class onto the
scheduled threadpool. |
ClusterInfoService.Listener
Modifier and Type | Field and Description |
---|---|
static String |
INTERNAL_CLUSTER_INFO_TIMEOUT |
static String |
INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL |
deprecationLogger, logger, settings
Constructor and Description |
---|
InternalClusterInfoService(Settings settings,
NodeSettingsService nodeSettingsService,
TransportNodesStatsAction transportNodesStatsAction,
TransportIndicesStatsAction transportIndicesStatsAction,
ClusterService clusterService,
ThreadPool threadPool) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(ClusterInfoService.Listener listener)
Add a listener that will be called every time new information is gathered
|
void |
clusterChanged(ClusterChangedEvent event)
Called when cluster state changes.
|
String |
executorName()
The name of the executor that the implementation of the callbacks of this lister should be executed on.
|
ClusterInfo |
getClusterInfo()
The latest cluster information
|
void |
offMaster()
Called when the local node used to be the master, a new master was elected and it's no longer the local node.
|
void |
onMaster()
Called when local node is elected to be the master
|
ClusterInfo |
refresh()
Refreshes the ClusterInfo in a blocking fashion
|
protected CountDownLatch |
updateIndicesStats(ActionListener<IndicesStatsResponse> listener)
Retrieve the latest indices stats, calling the listener when complete
|
protected CountDownLatch |
updateNodeStats(ActionListener<NodesStatsResponse> listener)
Retrieve the latest nodes stats, calling the listener when complete
|
logDeprecatedSetting, logRemovedSetting, nodeName
public static final String INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL
public static final String INTERNAL_CLUSTER_INFO_TIMEOUT
@Inject public InternalClusterInfoService(Settings settings, NodeSettingsService nodeSettingsService, TransportNodesStatsAction transportNodesStatsAction, TransportIndicesStatsAction transportIndicesStatsAction, ClusterService clusterService, ThreadPool threadPool)
public void onMaster()
LocalNodeMasterListener
onMaster
in interface LocalNodeMasterListener
public void offMaster()
LocalNodeMasterListener
offMaster
in interface LocalNodeMasterListener
public String executorName()
LocalNodeMasterListener
SAME
(indicating that the callbaks will run on the same thread as the cluster state events are fired with). On the other hand,
if the logic in the callbacks are heavier and take longer to process (or perhaps involve blocking due to IO operations),
prefer to execute them on a separte more appropriate executor (eg. GENERIC
or MANAGEMENT
).executorName
in interface LocalNodeMasterListener
public void clusterChanged(ClusterChangedEvent event)
ClusterStateListener
clusterChanged
in interface ClusterStateListener
public ClusterInfo getClusterInfo()
ClusterInfoService
getClusterInfo
in interface ClusterInfoService
public void addListener(ClusterInfoService.Listener listener)
ClusterInfoService
addListener
in interface ClusterInfoService
protected CountDownLatch updateNodeStats(ActionListener<NodesStatsResponse> listener)
protected CountDownLatch updateIndicesStats(ActionListener<IndicesStatsResponse> listener)
public final ClusterInfo refresh()
Copyright © 2009–2016. All rights reserved.