java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.cluster.service.ClusterService
- All Implemented Interfaces:
Closeable,AutoCloseable,LifecycleComponent,Releasable
-
Field Summary
FieldsFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionClusterService(Settings settings, ClusterSettings clusterSettings, MasterService masterService, ClusterApplierService clusterApplierService) ClusterService(Settings settings, ClusterSettings clusterSettings, ThreadPool threadPool) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a high priority applier of updated cluster states.voidaddListener(ClusterStateListener listener) Add a listener for updated cluster statesvoidAdd a listener for on/off local node master eventsvoidaddLowPriorityApplier(ClusterStateApplier applier) Adds an applier which will be called after all high priority and normal appliers have been called.voidaddStateApplier(ClusterStateApplier applier) Adds a applier of updated cluster states.static booleanprotected voiddoClose()protected voiddoStart()protected voiddoStop()final StringThe name of this node.The node's settings.The local node.voidremoveApplier(ClusterStateApplier applier) Removes an applier of updated cluster states.voidremoveListener(ClusterStateListener listener) Removes a listener for updated cluster states.voidsetNodeConnectionsService(NodeConnectionsService nodeConnectionsService) voidsetRerouteService(RerouteService rerouteService) state()The currently applied cluster state.<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.voidsubmitUnbatchedStateUpdateTask(String source, ClusterStateUpdateTask updateTask) Deprecated.Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
Field Details
-
USER_DEFINED_METADATA
-
-
Constructor Details
-
ClusterService
-
ClusterService
public ClusterService(Settings settings, ClusterSettings clusterSettings, MasterService masterService, ClusterApplierService clusterApplierService)
-
-
Method Details
-
setNodeConnectionsService
-
setRerouteService
-
getRerouteService
-
doStart
protected void doStart()- Specified by:
doStartin classAbstractLifecycleComponent
-
doStop
protected void doStop()- Specified by:
doStopin classAbstractLifecycleComponent
-
doClose
protected void doClose()- Specified by:
doClosein classAbstractLifecycleComponent
-
localNode
The local node. -
operationRouting
-
state
The currently applied cluster state. TODO: Should be renamed to appliedState / appliedClusterState -
addHighPriorityApplier
Adds a high priority applier of updated cluster states. -
addLowPriorityApplier
Adds an applier which will be called after all high priority and normal appliers have been called. -
addStateApplier
Adds a applier of updated cluster states. -
removeApplier
Removes an applier of updated cluster states. -
addListener
Add a listener for updated cluster states -
removeListener
Removes a listener for updated cluster states. -
addLocalNodeMasterListener
Add a listener for on/off local node master events -
getMasterService
-
getClusterApplierService
-
assertClusterOrMasterStateThread
public static boolean assertClusterOrMasterStateThread() -
getClusterName
-
getClusterSettings
-
getSettings
The node's settings. -
getNodeName
The name of this node. -
submitUnbatchedStateUpdateTask
@Deprecated public void submitUnbatchedStateUpdateTask(String source, ClusterStateUpdateTask updateTask) Deprecated.Submits an unbatched cluster state update task. This method exists for legacy reasons but is deprecated and forbidden in new production code because unbatched tasks are a source of performance and stability bugs. You should instead implement your update logic in a dedicatedClusterStateTaskExecutorwhich is reused across multiple task instances. The task itself is typically just a collection of parameters consumed by the executor, together with any listeners to be notified when execution completes.- Parameters:
source- the source of the cluster state update taskupdateTask- the full context for the cluster state update
-
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 and the callback 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 executor
-