Java Code Examples for org.elasticsearch.common.Priority#NORMAL
The following examples show how to use
org.elasticsearch.common.Priority#NORMAL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrioritizedEsThreadPoolExecutor.java From Elasticsearch with Apache License 2.0 | 6 votes |
public void execute(Runnable command, final ScheduledExecutorService timer, final TimeValue timeout, final Runnable timeoutCallback) { if (command instanceof PrioritizedRunnable) { command = new TieBreakingPrioritizedRunnable((PrioritizedRunnable) command, insertionOrder.incrementAndGet()); } else if (!(command instanceof PrioritizedFutureTask)) { // it might be a callable wrapper... command = new TieBreakingPrioritizedRunnable(command, Priority.NORMAL, insertionOrder.incrementAndGet()); } super.execute(command); if (timeout.nanos() >= 0) { if (command instanceof TieBreakingPrioritizedRunnable) { ((TieBreakingPrioritizedRunnable) command).scheduleTimeout(timer, timeoutCallback, timeout); } else { // We really shouldn't be here. The only way we can get here if somebody created PrioritizedFutureTask // and passed it to execute, which doesn't make much sense throw new UnsupportedOperationException("Execute with timeout is not supported for future tasks"); } } }
Example 2
Source File: PrioritizedEsThreadPoolExecutor.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public void execute(Runnable command) { if (command instanceof PrioritizedRunnable) { command = new TieBreakingPrioritizedRunnable((PrioritizedRunnable) command, insertionOrder.incrementAndGet()); } else if (!(command instanceof PrioritizedFutureTask)) { // it might be a callable wrapper... command = new TieBreakingPrioritizedRunnable(command, Priority.NORMAL, insertionOrder.incrementAndGet()); } super.execute(command); }
Example 3
Source File: PrioritizedEsThreadPoolExecutor.java From crate with Apache License 2.0 | 5 votes |
@Override protected Runnable wrapRunnable(Runnable command) { if (command instanceof PrioritizedRunnable) { if (command instanceof TieBreakingPrioritizedRunnable) { return command; } Priority priority = ((PrioritizedRunnable) command).priority(); return new TieBreakingPrioritizedRunnable(super.wrapRunnable(command), priority, insertionOrder.incrementAndGet()); } else if (command instanceof PrioritizedFutureTask) { return command; } else { // it might be a callable wrapper... return new TieBreakingPrioritizedRunnable(super.wrapRunnable(command), Priority.NORMAL, insertionOrder.incrementAndGet()); } }
Example 4
Source File: ClusterStateUpdateTask.java From Elasticsearch with Apache License 2.0 | 4 votes |
public ClusterStateUpdateTask() { this(Priority.NORMAL); }
Example 5
Source File: AckedClusterStateUpdateTask.java From Elasticsearch with Apache License 2.0 | 4 votes |
protected AckedClusterStateUpdateTask(AckedRequest request, ActionListener<Response> listener) { this(Priority.NORMAL, request, listener); }
Example 6
Source File: ClusterStateUpdateTask.java From crate with Apache License 2.0 | 4 votes |
public ClusterStateUpdateTask() { this(Priority.NORMAL); }
Example 7
Source File: AckedClusterStateUpdateTask.java From crate with Apache License 2.0 | 4 votes |
protected AckedClusterStateUpdateTask(AckedRequest request, ActionListener<Response> listener) { this(Priority.NORMAL, request, listener); }
Example 8
Source File: LocalClusterUpdateTask.java From crate with Apache License 2.0 | 4 votes |
public LocalClusterUpdateTask() { this(Priority.NORMAL); }