Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
Expand Down Expand Up @@ -295,16 +296,24 @@ public ThreadPoolStats stats() {
}

/**
* Get the generic executor service. This executor service {@link Executor#execute(Runnable)} method will run the {@link Runnable} it
* is given in the {@link ThreadContext} of the thread that queues it.
* Get the generic {@link ExecutorService}. This executor service
* {@link Executor#execute(Runnable)} method will run the {@link Runnable} it is given in the
* {@link ThreadContext} of the thread that queues it.
* <p>
* Warning: this {@linkplain ExecutorService} will not throw {@link RejectedExecutionException}
* if you submit a task while it shutdown. It will instead silently queue it and not run it.
*/
public ExecutorService generic() {
return executor(Names.GENERIC);
}

/**
* Get the executor service with the given name. This executor service's {@link Executor#execute(Runnable)} method will run the
* {@link Runnable} it is given in the {@link ThreadContext} of the thread that queues it.
* Get the {@link ExecutorService} with the given name. This executor service's
* {@link Executor#execute(Runnable)} method will run the {@link Runnable} it is given in the
* {@link ThreadContext} of the thread that queues it.
* <p>
* Warning: this {@linkplain ExecutorService} might not throw {@link RejectedExecutionException}
* if you submit a task while it shutdown. It will instead silently queue it and not run it.
*
* @param name the name of the executor service to obtain
* @throws IllegalArgumentException if no executor service with the specified name exists
Expand Down