public class ScheduledThreadPoolExecutorPlus extends java.util.concurrent.ScheduledThreadPoolExecutor implements ScheduledExecutorPlus
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
ExecutorPlus.MaximumPoolSizeListener
Modifier and Type | Field and Description |
---|---|
static java.util.concurrent.RejectedExecutionHandler |
rejectedExecutionHandler |
Modifier and Type | Method and Description |
---|---|
void |
execute(java.lang.Runnable run) |
void |
execute(WithResources withResources,
java.lang.Runnable run)
Invoke
task . |
int |
getActiveTaskCount()
Returns the approximate number of threads that are actively
executing tasks.
|
int |
getCorePoolSize()
Returns core pool size of thread pool, the minimum
number of workers (where that makes sense for a thread pool,
SEPExecutor does not have a minimum size).
|
int |
getMaximumPoolSize()
Returns maximum pool size of thread pool.
|
int |
getMaxTasksQueued() |
int |
getPendingTaskCount()
Returns the approximate total of tasks waiting to be executed.
|
NamedThreadFactory |
getThreadFactory() |
boolean |
inExecutor() |
protected <T> RunnableFuture<T> |
newTaskFor(java.util.concurrent.Callable<T> callable) |
protected <T> RunnableFuture<T> |
newTaskFor(java.lang.Runnable runnable,
T value) |
<V> java.util.concurrent.ScheduledFuture<V> |
schedule(java.util.concurrent.Callable<V> task,
long delay,
java.util.concurrent.TimeUnit unit) |
java.util.concurrent.ScheduledFuture<?> |
schedule(java.lang.Runnable task,
long delay,
java.util.concurrent.TimeUnit unit) |
java.util.concurrent.ScheduledFuture<?> |
scheduleAt(java.lang.Runnable run,
long deadline)
Schedule a timeout action.
|
java.util.concurrent.ScheduledFuture<?> |
scheduleAtFixedRate(java.lang.Runnable task,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit) |
java.util.concurrent.ScheduledFuture<?> |
scheduleSelfRecurring(java.lang.Runnable run,
long delay,
java.util.concurrent.TimeUnit units)
Schedule an action that is recurring but self-administered.
|
java.util.concurrent.ScheduledFuture<?> |
scheduleTimeoutAt(java.lang.Runnable run,
long deadline)
Schedule a timeout action.
|
java.util.concurrent.ScheduledFuture<?> |
scheduleTimeoutWithDelay(java.lang.Runnable run,
long delay,
java.util.concurrent.TimeUnit units)
Schedule a timeout action.
|
java.util.concurrent.ScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.Runnable task,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit unit) |
void |
setCorePoolSize(int number)
Allows user to resize minimum size of the thread pool.
|
void |
setMaximumPoolSize(int number)
Allows user to resize maximum size of the thread pool.
|
java.util.List<java.lang.Runnable> |
shutdownNow() |
<T> Future<T> |
submit(java.util.concurrent.Callable<T> call)
Overrides
ExecutorService.submit(Callable) to return a Cassandra Future |
Future<?> |
submit(java.lang.Runnable run)
Overrides
ExecutorService.submit(Runnable) to return a Cassandra Future |
<T> Future<T> |
submit(java.lang.Runnable run,
T result)
Overrides
ExecutorService.submit(Runnable, Object) to return a Cassandra Future |
<T> Future<T> |
submit(WithResources withResources,
java.util.concurrent.Callable<T> call)
Invoke
task , returning a future representing this computation. |
Future<?> |
submit(WithResources withResources,
java.lang.Runnable run)
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 run,
T result)
Invoke
task , returning a future yielding result if successful,
or the abnormal termination of task otherwise. |
protected void |
terminated() |
decorateTask, decorateTask, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdown
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getKeepAliveTime, getLargestPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setKeepAliveTime, setRejectedExecutionHandler, setThreadFactory, toString
invokeAll, invokeAll, invokeAny, invokeAny
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
invokeAll, invokeAll, invokeAny, invokeAny, maybeExecuteImmediately
getCompletedTaskCount
public static final java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler
public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable task, long delay, java.util.concurrent.TimeUnit unit)
schedule
in interface java.util.concurrent.ScheduledExecutorService
schedule
in class java.util.concurrent.ScheduledThreadPoolExecutor
public <V> java.util.concurrent.ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> task, long delay, java.util.concurrent.TimeUnit unit)
schedule
in interface java.util.concurrent.ScheduledExecutorService
schedule
in class java.util.concurrent.ScheduledThreadPoolExecutor
public java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable task, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
scheduleAtFixedRate
in interface java.util.concurrent.ScheduledExecutorService
scheduleAtFixedRate
in class java.util.concurrent.ScheduledThreadPoolExecutor
public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable task, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
scheduleWithFixedDelay
in interface java.util.concurrent.ScheduledExecutorService
scheduleWithFixedDelay
in class java.util.concurrent.ScheduledThreadPoolExecutor
public java.util.concurrent.ScheduledFuture<?> scheduleSelfRecurring(java.lang.Runnable run, long delay, java.util.concurrent.TimeUnit units)
ScheduledExecutorPlus
scheduleSelfRecurring
in interface ScheduledExecutorPlus
public java.util.concurrent.ScheduledFuture<?> scheduleAt(java.lang.Runnable run, long deadline)
ScheduledExecutorPlus
scheduleAt
in interface ScheduledExecutorPlus
public java.util.concurrent.ScheduledFuture<?> scheduleTimeoutAt(java.lang.Runnable run, long deadline)
ScheduledExecutorPlus
scheduleTimeoutAt
in interface ScheduledExecutorPlus
public java.util.concurrent.ScheduledFuture<?> scheduleTimeoutWithDelay(java.lang.Runnable run, long delay, java.util.concurrent.TimeUnit units)
ScheduledExecutorPlus
scheduleTimeoutWithDelay
in interface ScheduledExecutorPlus
public void execute(java.lang.Runnable run)
execute
in interface java.util.concurrent.Executor
execute
in class java.util.concurrent.ScheduledThreadPoolExecutor
public void execute(WithResources withResources, java.lang.Runnable run)
ExecutorPlus
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();
}
execute
in interface ExecutorPlus
withResources
- the resources to create and hold while executing task
run
- the task to executepublic Future<?> submit(java.lang.Runnable run)
ExecutorPlus
ExecutorService.submit(Runnable)
to return a Cassandra Future
submit
in interface java.util.concurrent.ExecutorService
submit
in interface ExecutorPlus
submit
in class java.util.concurrent.ScheduledThreadPoolExecutor
public <T> Future<T> submit(java.lang.Runnable run, T result)
ExecutorPlus
ExecutorService.submit(Runnable, Object)
to return a Cassandra Future
submit
in interface java.util.concurrent.ExecutorService
submit
in interface ExecutorPlus
submit
in class java.util.concurrent.ScheduledThreadPoolExecutor
public <T> Future<T> submit(java.util.concurrent.Callable<T> call)
ExecutorPlus
ExecutorService.submit(Callable)
to return a Cassandra Future
submit
in interface java.util.concurrent.ExecutorService
submit
in interface ExecutorPlus
submit
in class java.util.concurrent.ScheduledThreadPoolExecutor
public <T> Future<T> submit(WithResources withResources, java.lang.Runnable run, T result)
ExecutorPlus
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;
}
submit
in interface ExecutorPlus
withResources
- the resources to create and hold while executing task
run
- the task to executeresult
- the result if successfulpublic Future<?> submit(WithResources withResources, java.lang.Runnable run)
ExecutorPlus
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;
}
submit
in interface ExecutorPlus
withResources
- the resources to create and hold while executing task
run
- the task to executepublic <T> Future<T> submit(WithResources withResources, java.util.concurrent.Callable<T> call)
ExecutorPlus
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();
}
submit
in interface ExecutorPlus
withResources
- the resources to create and hold while executing task
call
- the task to executepublic boolean inExecutor()
inExecutor
in interface ExecutorPlus
protected <T> RunnableFuture<T> newTaskFor(java.lang.Runnable runnable, T value)
newTaskFor
in class java.util.concurrent.AbstractExecutorService
protected <T> RunnableFuture<T> newTaskFor(java.util.concurrent.Callable<T> callable)
newTaskFor
in class java.util.concurrent.AbstractExecutorService
public NamedThreadFactory getThreadFactory()
getThreadFactory
in class java.util.concurrent.ThreadPoolExecutor
public java.util.List<java.lang.Runnable> shutdownNow()
shutdownNow
in interface java.util.concurrent.ExecutorService
shutdownNow
in class java.util.concurrent.ScheduledThreadPoolExecutor
protected void terminated()
terminated
in class java.util.concurrent.ThreadPoolExecutor
public int getActiveTaskCount()
ResizableThreadPool
getActiveTaskCount
in interface ResizableThreadPool
public int getPendingTaskCount()
ResizableThreadPool
getPendingTaskCount
in interface ResizableThreadPool
public int getCorePoolSize()
ResizableThreadPool
getCorePoolSize
in interface ResizableThreadPool
getCorePoolSize
in class java.util.concurrent.ThreadPoolExecutor
public void setCorePoolSize(int number)
ResizableThreadPool
setCorePoolSize
in interface ResizableThreadPool
setCorePoolSize
in class java.util.concurrent.ThreadPoolExecutor
public int getMaximumPoolSize()
ResizableThreadPool
getMaximumPoolSize
in interface ResizableThreadPool
getMaximumPoolSize
in class java.util.concurrent.ThreadPoolExecutor
public void setMaximumPoolSize(int number)
ResizableThreadPool
setMaximumPoolSize
in interface ResizableThreadPool
setMaximumPoolSize
in class java.util.concurrent.ThreadPoolExecutor
public int getMaxTasksQueued()
getMaxTasksQueued
in interface ResizableThreadPool
Copyright © 2009- The Apache Software Foundation