Class ClusterService

All Implemented Interfaces:
Closeable, AutoCloseable, LifecycleComponent, Releasable

public class ClusterService extends AbstractLifecycleComponent
  • Field Details

  • Constructor Details

  • Method Details

    • threadPool

      public ThreadPool threadPool()
    • setNodeConnectionsService

      public void setNodeConnectionsService(NodeConnectionsService nodeConnectionsService)
    • setRerouteService

      public void setRerouteService(RerouteService rerouteService)
    • getRerouteService

      public RerouteService getRerouteService()
    • doStart

      protected void doStart()
      Specified by:
      doStart in class AbstractLifecycleComponent
    • doStop

      protected void doStop()
      Specified by:
      doStop in class AbstractLifecycleComponent
    • doClose

      protected void doClose()
      Specified by:
      doClose in class AbstractLifecycleComponent
    • localNode

      public DiscoveryNode localNode()
      The local node.
    • operationRouting

      public OperationRouting operationRouting()
    • state

      public ClusterState state()
      The currently applied cluster state. TODO: Should be renamed to appliedState / appliedClusterState
    • addHighPriorityApplier

      public void addHighPriorityApplier(ClusterStateApplier applier)
      Adds a high priority applier of updated cluster states.
    • addLowPriorityApplier

      public void addLowPriorityApplier(ClusterStateApplier applier)
      Adds an applier which will be called after all high priority and normal appliers have been called.
    • addStateApplier

      public void addStateApplier(ClusterStateApplier applier)
      Adds a applier of updated cluster states.
    • removeApplier

      public void removeApplier(ClusterStateApplier applier)
      Removes an applier of updated cluster states.
    • addListener

      public void addListener(ClusterStateListener listener)
      Add a listener for updated cluster states
    • removeListener

      public void removeListener(ClusterStateListener listener)
      Removes a listener for updated cluster states.
    • addLocalNodeMasterListener

      public void addLocalNodeMasterListener(LocalNodeMasterListener listener)
      Add a listener for on/off local node master events
    • getMasterService

      public MasterService getMasterService()
    • getClusterApplierService

      public ClusterApplierService getClusterApplierService()
    • assertClusterOrMasterStateThread

      public static boolean assertClusterOrMasterStateThread()
    • getClusterName

      public ClusterName getClusterName()
    • getClusterSettings

      public ClusterSettings getClusterSettings()
    • getSettings

      public Settings getSettings()
      The node's settings.
    • getNodeName

      public final String 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 dedicated ClusterStateTaskExecutor which 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 task
      updateTask - the full context for the cluster state update
    • createTaskQueue

      public <T extends ClusterStateTaskListener> MasterServiceTaskQueue<T> createTaskQueue(String name, Priority priority, ClusterStateTaskExecutor<T> executor)
      Create a new task queue which can be used to submit tasks for execution by the master service. Tasks submitted to the same queue (while the master service is otherwise busy) will be batched together into a single cluster state update. You should therefore re-use each queue as much as possible.
      Type Parameters:
      T - The type of the tasks
      Parameters:
      name - The name of the queue, which is mostly useful for debugging.
      priority - The priority at which tasks submitted to the queue are executed. Avoid priorites other than Priority.NORMAL where possible. A stream of higher-priority tasks can starve lower-priority ones from running. Higher-priority tasks should definitely re-use the same MasterServiceTaskQueue so that they are executed in batches.
      executor - The executor which processes each batch of tasks.
      Returns:
      A new batching task queue.