public interface CompletableExecutorService extends ExecutorService
CompletableFuture
s.Modifier and Type | Method and Description |
---|---|
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
static CompletableExecutorService |
makeCompletable(ExecutorService executor)
Converts the specified service into a
CompletableExecutorService . |
static CompletableExecutorService |
sameThreadExecutorService()
Returns a new executor service that runs each task synchronously in the same thread that
submits it.
|
<T> CompletableFuture<T> |
submit(Callable<T> task) |
CompletableFuture<Void> |
submit(Runnable task) |
<T> CompletableFuture<T> |
submit(Runnable task,
T result) |
awaitTermination, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
<T> CompletableFuture<T> submit(Callable<T> task)
Overrides the return type to be completable.
submit
in interface ExecutorService
<T> CompletableFuture<T> submit(Runnable task, T result)
Overrides the return type to be completable.
submit
in interface ExecutorService
CompletableFuture<Void> submit(Runnable task)
Overrides the return type to be completable.
submit
in interface ExecutorService
<T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
Every instance in the returned list will be an instance of CompletableFuture
.
invokeAll
in interface ExecutorService
InterruptedException
<T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
Every instance in the returned list will be an instance of CompletableFuture
.
invokeAll
in interface ExecutorService
InterruptedException
static CompletableExecutorService sameThreadExecutorService()
static CompletableExecutorService makeCompletable(ExecutorService executor)
CompletableExecutorService
. If the specified
service is already completable, it is returned without any conversion.
Instances of CompletableFuture
returned from the executor's various submit
methods differ from typical completable futures in that a call to future.cancel(true)
will attempt to interrupt the thread that is running the associated task. (See
CompletableFutures.callInterruptiblyAsync(Callable, Executor)
.)
executor
- the executor service