public class InternalClusterService extends AbstractLifecycleComponent<ClusterService> implements ClusterService
Modifier and Type | Field and Description |
---|---|
static String |
SETTING_CLUSTER_SERVICE_RECONNECT_INTERVAL |
static String |
SETTING_CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD |
static String |
UPDATE_THREAD_NAME |
lifecycle
deprecationLogger, logger, settings
Constructor and Description |
---|
InternalClusterService(Settings settings,
DiscoveryService discoveryService,
OperationRouting operationRouting,
TransportService transportService,
NodeSettingsService nodeSettingsService,
ThreadPool threadPool,
ClusterName clusterName,
DiscoveryNodeService discoveryNodeService,
Version version) |
Modifier and Type | Method and Description |
---|---|
void |
add(ClusterStateListener listener)
Adds a listener for updated cluster states.
|
void |
add(LocalNodeMasterListener listener)
Add a listener for on/off local node master events
|
void |
add(TimeValue timeout,
TimeoutClusterStateListener listener)
Adds a cluster state listener that will timeout after the provided timeout,
and is executed after the clusterstate has been successfully applied ie.
|
void |
addFirst(ClusterStateListener listener)
Adds a priority listener for updated cluster states.
|
void |
addInitialStateBlock(ClusterBlock block)
Adds an initial block to be set on the first cluster state created.
|
void |
addLast(ClusterStateListener listener)
Adds last listener.
|
boolean |
assertClusterStateThread()
asserts that the current thread is the cluster state update thread
|
protected void |
doClose() |
protected void |
doStart() |
protected void |
doStop() |
TimeValue |
getMaxTaskWaitTime()
Returns the maximum wait time for tasks in the queue
|
TaskManager |
getTaskManager()
Returns task manager created in the cluster service
|
DiscoveryNode |
localNode()
The local node.
|
int |
numberOfPendingTasks()
Returns the number of currently pending tasks.
|
OperationRouting |
operationRouting()
The operation routing.
|
List<PendingClusterTask> |
pendingTasks()
Returns the tasks that are pending.
|
void |
remove(ClusterStateListener listener)
Removes a listener for updated cluster states.
|
void |
remove(LocalNodeMasterListener listener)
Remove the given listener for on/off local master events
|
void |
removeInitialStateBlock(ClusterBlock block)
Remove an initial block to be set on the first cluster state created.
|
NodeSettingsService |
settingsService() |
ClusterState |
state()
The current state.
|
void |
submitStateUpdateTask(String source,
ClusterStateUpdateTask updateTask)
Submits a cluster state update task; unlike
ClusterService.submitStateUpdateTask(String, Object, ClusterStateTaskConfig, ClusterStateTaskExecutor, ClusterStateTaskListener) ,
submitted updates will not be batched. |
<T> void |
submitStateUpdateTask(String source,
T task,
ClusterStateTaskConfig config,
ClusterStateTaskExecutor<T> executor,
ClusterStateTaskListener listener)
Submits a cluster state update task; submitted updates will be
batched across the same instance of executor.
|
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
logDeprecatedSetting, logRemovedSetting, nodeName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop
close
public static final String SETTING_CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD
public static final String SETTING_CLUSTER_SERVICE_RECONNECT_INTERVAL
public static final String UPDATE_THREAD_NAME
@Inject public InternalClusterService(Settings settings, DiscoveryService discoveryService, OperationRouting operationRouting, TransportService transportService, NodeSettingsService nodeSettingsService, ThreadPool threadPool, ClusterName clusterName, DiscoveryNodeService discoveryNodeService, Version version)
public NodeSettingsService settingsService()
public void addInitialStateBlock(ClusterBlock block) throws IllegalStateException
ClusterService
addInitialStateBlock
in interface ClusterService
IllegalStateException
public void removeInitialStateBlock(ClusterBlock block) throws IllegalStateException
ClusterService
removeInitialStateBlock
in interface ClusterService
IllegalStateException
protected void doStart()
doStart
in class AbstractLifecycleComponent<ClusterService>
protected void doStop()
doStop
in class AbstractLifecycleComponent<ClusterService>
protected void doClose()
doClose
in class AbstractLifecycleComponent<ClusterService>
public DiscoveryNode localNode()
ClusterService
localNode
in interface ClusterService
public OperationRouting operationRouting()
ClusterService
operationRouting
in interface ClusterService
public ClusterState state()
ClusterService
state
in interface ClusterService
public void addFirst(ClusterStateListener listener)
ClusterService
addFirst
in interface ClusterService
public void addLast(ClusterStateListener listener)
ClusterService
addLast
in interface ClusterService
public void add(ClusterStateListener listener)
ClusterService
add
in interface ClusterService
public void remove(ClusterStateListener listener)
ClusterService
remove
in interface ClusterService
public void add(LocalNodeMasterListener listener)
ClusterService
add
in interface ClusterService
public void remove(LocalNodeMasterListener listener)
ClusterService
remove
in interface ClusterService
public void add(@Nullable TimeValue timeout, TimeoutClusterStateListener listener)
ClusterService
ClusterState.ClusterStateStatus.APPLIED
NOTE: a null
timeout means that the listener will never be removed
automaticallyadd
in interface ClusterService
public void submitStateUpdateTask(String source, ClusterStateUpdateTask updateTask)
ClusterService
ClusterService.submitStateUpdateTask(String, Object, ClusterStateTaskConfig, ClusterStateTaskExecutor, ClusterStateTaskListener)
,
submitted updates will not be batched.submitStateUpdateTask
in interface ClusterService
source
- the source of the cluster state update taskupdateTask
- the full context for the cluster state update
taskpublic <T> void submitStateUpdateTask(String source, T task, ClusterStateTaskConfig config, ClusterStateTaskExecutor<T> executor, ClusterStateTaskListener listener)
ClusterService
submitStateUpdateTask
in interface ClusterService
T
- the type of the cluster state update task statesource
- the source of the cluster state update tasktask
- the state needed for the cluster state update taskconfig
- the cluster state update task configurationexecutor
- the cluster state update task executor; tasks
that share the same executor will be executed
batches on this executorlistener
- callback after the cluster state update task
completespublic List<PendingClusterTask> pendingTasks()
ClusterService
pendingTasks
in interface ClusterService
public int numberOfPendingTasks()
ClusterService
numberOfPendingTasks
in interface ClusterService
public TimeValue getMaxTaskWaitTime()
ClusterService
getMaxTaskWaitTime
in interface ClusterService
public TaskManager getTaskManager()
ClusterService
getTaskManager
in interface ClusterService
public boolean assertClusterStateThread()
Copyright © 2009–2016. All rights reserved.