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 Setting<TimeValue> |
INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING |
static Setting<TimeValue> |
INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING |
deprecationLogger, logger, settings
Constructor and Description |
---|
InternalClusterInfoService(Settings settings,
ClusterService clusterService,
ThreadPool threadPool,
NodeClient client) |
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.
|
java.lang.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 java.util.concurrent.CountDownLatch |
updateIndicesStats(ActionListener<IndicesStatsResponse> listener)
Retrieve the latest indices stats, calling the listener when complete
|
protected java.util.concurrent.CountDownLatch |
updateNodeStats(ActionListener<NodesStatsResponse> listener)
Retrieve the latest nodes stats, calling the listener when complete
|
logDeprecatedSetting, logRemovedSetting, nodeName
public static final Setting<TimeValue> INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING
public InternalClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client)
public void onMaster()
LocalNodeMasterListener
onMaster
in interface LocalNodeMasterListener
public void offMaster()
LocalNodeMasterListener
offMaster
in interface LocalNodeMasterListener
public java.lang.String executorName()
LocalNodeMasterListener
SAME
(indicating that the callbacks 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 separate 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 java.util.concurrent.CountDownLatch updateNodeStats(ActionListener<NodesStatsResponse> listener)
protected java.util.concurrent.CountDownLatch updateIndicesStats(ActionListener<IndicesStatsResponse> listener)
public final ClusterInfo refresh()