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 encapsulatingExecutorLocalswithout leaking implementing classes).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceExecutorPlus.MaximumPoolSizeListener
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidexecute(WithResources withResources, java.lang.Runnable task)Invoketask.booleaninExecutor()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> TinvokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)default <T> TinvokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit)default voidmaybeExecuteImmediately(java.lang.Runnable task)MAY executetaskimmediately, 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 CassandraFutureFuture<?>submit(WithResources withResources, java.lang.Runnable task)Invoketask, returning a future yieldingnullif successful, or the abnormal termination oftaskotherwise.<T> Future<T>submit(WithResources withResources, java.lang.Runnable task, T result)Invoketask, returning a future yieldingresultif successful, or the abnormal termination oftaskotherwise.<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 executetaskimmediately, 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:
submitin 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:
submitin interfacejava.util.concurrent.ExecutorService
-
submit
Future<?> submit(java.lang.Runnable task)
OverridesExecutorService.submit(Runnable)to return a CassandraFuture- Specified by:
submitin 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 executingtasktask- 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 executingtasktask- the task to execute
-
submit
Future<?> submit(WithResources withResources, java.lang.Runnable task)
Invoketask, returning a future yieldingnullif successful, or the abnormal termination oftaskotherwise. 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 executingtasktask- the task to execute
-
submit
<T> Future<T> submit(WithResources withResources, java.lang.Runnable task, T result)
Invoketask, returning a future yieldingresultif successful, or the abnormal termination oftaskotherwise. 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 executingtasktask- 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:
invokeAllin 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:
invokeAllin 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:
invokeAnyin interfacejava.util.concurrent.ExecutorService- Throws:
java.lang.InterruptedExceptionjava.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:
invokeAnyin interfacejava.util.concurrent.ExecutorService- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutException
-
-