Module org.elasticsearch.server
Interface MasterServiceTaskQueue<T extends ClusterStateTaskListener>
- Type Parameters:
T
- The type of task to process.
public interface MasterServiceTaskQueue<T extends ClusterStateTaskListener>
A queue of tasks for the master service to execute. Tasks submitted to the same queue can be processed as a batch, resulting in a single
cluster state update. Queues are typically created during initialization using
MasterService.createTaskQueue(java.lang.String, org.elasticsearch.common.Priority, org.elasticsearch.cluster.ClusterStateTaskExecutor<T>)
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
submitTask
(String source, T task, TimeValue timeout) Submit a task to the queue.
-
Method Details
-
submitTask
Submit a task to the queue.- Parameters:
source
- A description of the task.task
- The task to execute.timeout
- An optional timeout for the task. If the task is not processed before the timeout elapses, it fails with aProcessClusterEventTimeoutException
(which is passed toClusterStateTaskListener.onFailure(java.lang.Exception)
). Tasks that are directly associated with user actions conventionally use a timeout which comes from the REST parameter?master_timeout
, which is typically available fromMasterNodeRequest.masterNodeTimeout()
. Tasks that correspond with internal actions should normally have no timeout since it is usually better to wait patiently in the queue until processed rather than to fail, especially if the only reasonable reaction to a failure is to retry.The values
null
andMasterNodeRequest.INFINITE_MASTER_NODE_TIMEOUT
(i.e.TimeValue.MINUS_ONE
) both indicate that the task should never time out.
-