Package org.apache.cassandra.concurrent
Interface ExecutorPlus
-
- All Superinterfaces:
java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
,ResizableThreadPool
- All Known Subinterfaces:
LocalAwareExecutorPlus
,LocalAwareSequentialExecutorPlus
,ScheduledExecutorPlus
,SequentialExecutorPlus
- All Known Implementing Classes:
CompactionManager.ValidationExecutor
,ImmediateExecutor
,LocalAwareSingleThreadExecutorPlus
,LocalAwareThreadPoolExecutorPlus
,ScheduledThreadPoolExecutorPlus
,SEPExecutor
,SingleThreadExecutorPlus
,ThreadPoolExecutorPlus
,WrappedExecutorPlus
public interface ExecutorPlus extends java.util.concurrent.ExecutorService, ResizableThreadPool
Cassandra's extension ofExecutorService
, using our ownFuture
, supportinginExecutor()
, and execution with associated resourcesexecute(WithResources, Runnable)
(which is primarily used for encapsulatingExecutorLocals
without leaking implementing classes).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ExecutorPlus.MaximumPoolSizeListener
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
execute(WithResources withResources, java.lang.Runnable task)
Invoketask
.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 executetask
immediately, if the calling thread is permitted to do so.Future<?>
submit(java.lang.Runnable task)
OverridesExecutorService.submit(Runnable)
to return a CassandraFuture
<T> Future<T>
submit(java.lang.Runnable task, T result)
OverridesExecutorService.submit(Runnable, Object)
to return a CassandraFuture
<T> Future<T>
submit(java.util.concurrent.Callable<T> task)
OverridesExecutorService.submit(Callable)
to return a CassandraFuture
Future<?>
submit(WithResources withResources, java.lang.Runnable task)
Invoketask
, returning a future yieldingnull
if successful, or the abnormal termination oftask
otherwise.<T> Future<T>
submit(WithResources withResources, java.lang.Runnable task, T result)
Invoketask
, returning a future yieldingresult
if successful, or the abnormal termination oftask
otherwise.<T> Future<T>
submit(WithResources withResources, java.util.concurrent.Callable<T> task)
Invoketask
, returning a future representing this computation.-
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, isShutdown, isTerminated, shutdown, shutdownNow
-
Methods inherited from interface org.apache.cassandra.concurrent.ResizableThreadPool
getActiveTaskCount, getCompletedTaskCount, getCorePoolSize, getMaximumPoolSize, getMaxTasksQueued, getPendingTaskCount, oldestTaskQueueTime, setCorePoolSize, setMaximumPoolSize
-
-
-
-
Method Detail
-
maybeExecuteImmediately
default void maybeExecuteImmediately(java.lang.Runnable task)
MAY executetask
immediately, if the calling thread is permitted to do so.
-
submit
<T> Future<T> submit(java.util.concurrent.Callable<T> task)
OverridesExecutorService.submit(Callable)
to return a CassandraFuture
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
-
submit
<T> Future<T> submit(java.lang.Runnable task, T result)
OverridesExecutorService.submit(Runnable, Object)
to return a CassandraFuture
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
-
submit
Future<?> submit(java.lang.Runnable task)
OverridesExecutorService.submit(Runnable)
to return a CassandraFuture
- Specified by:
submit
in interfacejava.util.concurrent.ExecutorService
-
execute
void execute(WithResources withResources, java.lang.Runnable task)
Invoketask
. The invoking thread will first instantiate the resources provided before invokingtask
, 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(); }
- Parameters:
withResources
- the resources to create and hold while executingtask
task
- the task to execute
-
submit
<T> Future<T> submit(WithResources withResources, java.util.concurrent.Callable<T> task)
Invoketask
, returning a future representing this computation. The invoking thread will first instantiate the resources provided before invokingtask
, 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(); }
- Parameters:
withResources
- the resources to create and hold while executingtask
task
- the task to execute
-
submit
Future<?> submit(WithResources withResources, java.lang.Runnable task)
Invoketask
, returning a future yieldingnull
if successful, or the abnormal termination oftask
otherwise. The invoking thread will first instantiate the resources provided before invokingtask
, so that thread state may be modified and cleaned uptry (Closeable close = withResources.get()) { task.run(); return null; }
- Parameters:
withResources
- the resources to create and hold while executingtask
task
- the task to execute
-
submit
<T> Future<T> submit(WithResources withResources, java.lang.Runnable task, T result)
Invoketask
, returning a future yieldingresult
if successful, or the abnormal termination oftask
otherwise. The invoking thread will first instantiate the resources provided before invokingtask
, 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; }
- Parameters:
withResources
- the resources to create and hold while executingtask
task
- the task to executeresult
- the result if successful
-
inExecutor
boolean inExecutor()
- Returns:
- true iff the caller is a worker thread actively serving this executor
-
invokeAll
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
- Specified by:
invokeAll
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
-
invokeAll
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
- Specified by:
invokeAll
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
-
invokeAny
default <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
invokeAny
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
-
invokeAny
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
- Specified by:
invokeAny
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
-
-