public interface ExecutorPlus extends java.util.concurrent.ExecutorService, ResizableThreadPool
ExecutorService
, using our own Future
, supporting
inExecutor()
, and execution with associated resources execute(WithResources, Runnable)
(which is primarily used for encapsulating ExecutorLocals
without leaking implementing classes).Modifier and Type | Interface and Description |
---|---|
static interface |
ExecutorPlus.MaximumPoolSizeListener |
Modifier and Type | Method and Description |
---|---|
void |
execute(WithResources withResources,
java.lang.Runnable task)
Invoke
task . |
boolean |
inExecutor() |
default <T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
default <T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
default <T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
default <T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
default void |
maybeExecuteImmediately(java.lang.Runnable task)
MAY execute
task immediately, if the calling thread is permitted to do so. |
<T> Future<T> |
submit(java.util.concurrent.Callable<T> task)
Overrides
ExecutorService.submit(Callable) to return a Cassandra Future |
Future<?> |
submit(java.lang.Runnable task)
Overrides
ExecutorService.submit(Runnable) to return a Cassandra Future |
<T> Future<T> |
submit(java.lang.Runnable task,
T result)
Overrides
ExecutorService.submit(Runnable, Object) to return a Cassandra Future |
<T> Future<T> |
submit(WithResources withResources,
java.util.concurrent.Callable<T> task)
Invoke
task , returning a future representing this computation. |
Future<?> |
submit(WithResources withResources,
java.lang.Runnable task)
Invoke
task , returning a future yielding null if successful,
or the abnormal termination of task otherwise. |
<T> Future<T> |
submit(WithResources withResources,
java.lang.Runnable task,
T result)
Invoke
task , returning a future yielding result if successful,
or the abnormal termination of task otherwise. |
awaitTermination, isShutdown, isTerminated, shutdown, shutdownNow
getActiveTaskCount, getCompletedTaskCount, getCorePoolSize, getMaximumPoolSize, getMaxTasksQueued, getPendingTaskCount, setCorePoolSize, setMaximumPoolSize
default void maybeExecuteImmediately(java.lang.Runnable task)
task
immediately, if the calling thread is permitted to do so.<T> Future<T> submit(java.util.concurrent.Callable<T> task)
ExecutorService.submit(Callable)
to return a Cassandra Future
submit
in interface java.util.concurrent.ExecutorService
<T> Future<T> submit(java.lang.Runnable task, T result)
ExecutorService.submit(Runnable, Object)
to return a Cassandra Future
submit
in interface java.util.concurrent.ExecutorService
Future<?> submit(java.lang.Runnable task)
ExecutorService.submit(Runnable)
to return a Cassandra Future
submit
in interface java.util.concurrent.ExecutorService
void execute(WithResources withResources, java.lang.Runnable task)
task
. The invoking thread will first instantiate the resources provided before
invoking task
, so that thread state may be modified and cleaned up.
The invoking thread will execute something semantically equivlent to:
try (Closeable close = withResources.get())
{
task.run();
}
withResources
- the resources to create and hold while executing task
task
- the task to execute<T> Future<T> submit(WithResources withResources, java.util.concurrent.Callable<T> task)
task
, returning a future representing this computation.
The invoking thread will first instantiate the resources provided before
invoking task
, so that thread state may be modified and cleaned up.
The invoking thread will execute something semantically equivlent to:
try (Closeable close = withResources.get())
{
return task.call();
}
withResources
- the resources to create and hold while executing task
task
- the task to executeFuture<?> submit(WithResources withResources, java.lang.Runnable task)
task
, returning a future yielding null
if successful,
or the abnormal termination of task
otherwise.
The invoking thread will first instantiate the resources provided before
invoking task
, so that thread state may be modified and cleaned up
try (Closeable close = withResources.get())
{
task.run();
return null;
}
withResources
- the resources to create and hold while executing task
task
- the task to execute<T> Future<T> submit(WithResources withResources, java.lang.Runnable task, T result)
task
, returning a future yielding result
if successful,
or the abnormal termination of task
otherwise.
The invoking thread will first instantiate the resources provided before
invoking task
, so that thread state may be modified and cleaned up.
The invoking thread will execute something semantically equivlent to:
try (Closeable close = withResources.get())
{
task.run();
return result;
}
withResources
- the resources to create and hold while executing task
task
- the task to executeresult
- the result if successfulboolean inExecutor()
default <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) throws java.lang.InterruptedException
invokeAll
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
default <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
invokeAll
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
default <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
invokeAny
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
java.util.concurrent.ExecutionException
default <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
invokeAny
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
Copyright © 2009-2022 The Apache Software Foundation