Class MasterService
java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.cluster.service.MasterService
- All Implemented Interfaces:
Closeable,AutoCloseable,LifecycleComponent,org.elasticsearch.core.Releasable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Setting<org.elasticsearch.core.TimeValue>static final Setting<org.elasticsearch.core.TimeValue>protected final ThreadPoolFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionMasterService(Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool) -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanassertNotMasterUpdateThread(String reason) protected PrioritizedEsThreadPoolExecutorprotected voiddoClose()protected voiddoStart()protected voiddoStop()org.elasticsearch.core.TimeValueReturns the maximum wait time for tasks in the queueincrementVersion(ClusterState clusterState) static booleanintReturns the number of currently pending tasks.Returns the tasks that are pending.protected voidpublish(ClusterStatePublicationEvent clusterStatePublicationEvent, ClusterStatePublisher.AckListener ackListener, ActionListener<Void> publicationListener) voidsetClusterStatePublisher(ClusterStatePublisher publisher) voidsetClusterStateSupplier(Supplier<ClusterState> clusterStateSupplier) <T extends ClusterStateTaskListener>
voidsubmitStateUpdateTask(String source, T task, ClusterStateTaskConfig config, ClusterStateTaskExecutor<T> executor) Submits a cluster state update task; submitted updates will be batched across the same instance of executor.<T extends ClusterStateTaskConfig & ClusterStateTaskListener>
voidsubmitStateUpdateTask(String source, T updateTask, ClusterStateTaskExecutor<T> executor) Submits a cluster state update taskMethods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
Field Details
-
MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING
public static final Setting<org.elasticsearch.core.TimeValue> MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING -
MASTER_SERVICE_STARVATION_LOGGING_THRESHOLD_SETTING
public static final Setting<org.elasticsearch.core.TimeValue> MASTER_SERVICE_STARVATION_LOGGING_THRESHOLD_SETTING -
threadPool
-
-
Constructor Details
-
MasterService
-
-
Method Details
-
setClusterStatePublisher
-
setClusterStateSupplier
-
doStart
protected void doStart()- Specified by:
doStartin classAbstractLifecycleComponent
-
createThreadPoolExecutor
-
getClusterStateUpdateStats
-
doStop
protected void doStop()- Specified by:
doStopin classAbstractLifecycleComponent
-
doClose
protected void doClose()- Specified by:
doClosein classAbstractLifecycleComponent
-
isMasterUpdateThread
public static boolean isMasterUpdateThread() -
assertNotMasterUpdateThread
-
publish
protected void publish(ClusterStatePublicationEvent clusterStatePublicationEvent, ClusterStatePublisher.AckListener ackListener, ActionListener<Void> publicationListener) -
incrementVersion
-
submitStateUpdateTask
public <T extends ClusterStateTaskConfig & ClusterStateTaskListener> void submitStateUpdateTask(String source, T updateTask, ClusterStateTaskExecutor<T> executor) Submits a cluster state update task- Parameters:
source- the source of the cluster state update taskupdateTask- the full context for the cluster state update, which implementsClusterStateTaskListenerso that it is notified when it is executed.executor- the executor for the task; tasks that share the same executor instance may be batched together
-
submitStateUpdateTask
public <T extends ClusterStateTaskListener> void submitStateUpdateTask(String source, T task, ClusterStateTaskConfig config, ClusterStateTaskExecutor<T> executor) Submits a cluster state update task; submitted updates will be batched across the same instance of executor. The exact batching semantics depend on the underlying implementation but a rough guideline is that if the update task is submitted while there are pending update tasks for the same executor, these update tasks will all be executed on the executor in a single batch- Type Parameters:
T- the type of the cluster state update task state- Parameters:
source- the source of the cluster state update tasktask- the state needed for the cluster state update task, which implementsClusterStateTaskListenerso that it is notified when it is executed.config- the cluster state update task configurationexecutor- the cluster state update task executor; tasks that share the same executor will be executed batches on this executor
-
pendingTasks
Returns the tasks that are pending. -
numberOfPendingTasks
public int numberOfPendingTasks()Returns the number of currently pending tasks. -
getMaxTaskWaitTime
public org.elasticsearch.core.TimeValue getMaxTaskWaitTime()Returns the maximum wait time for tasks in the queue- Returns:
- A zero time value if the queue is empty, otherwise the time value oldest task waiting in the queue
-