public class CachedThreadPoolExecutor extends AFThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.atomic.AtomicBoolean |
fullSize
Whether the pool (its amount of core threads) is set to the maximum size.
|
protected int |
realCoreSize
The normal core size of the pool.
|
protected int |
realMaxSize
The maximum size of the pool.
|
protected java.util.concurrent.atomic.AtomicInteger |
workSize
The amount of work currently in the pool.
|
activeThreads, completedTasks, submittedTasks| Constructor and Description |
|---|
CachedThreadPoolExecutor(int corePoolSize,
int maxPoolSize,
boolean prestart,
Adept2ThreadFactory threadFactory)
Creates a new CachedThreadPoolExecutor with the given initial
parameters and default rejected execution handler.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterExecute(java.lang.Runnable r,
java.lang.Throwable t) |
void |
execute(java.lang.Runnable task) |
beforeExecute, newTaskFor, newTaskFor, setLogExecuteCallStack, updateQueueLimitallowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toStringprotected final int realCoreSize
protected final int realMaxSize
protected final java.util.concurrent.atomic.AtomicBoolean fullSize
protected final java.util.concurrent.atomic.AtomicInteger workSize
public CachedThreadPoolExecutor(int corePoolSize,
int maxPoolSize,
boolean prestart,
Adept2ThreadFactory threadFactory)
corePoolSize - The number of threads to keep in the pool, even if they
are idle.maxPoolSize - The maximum number of threads to allow in the pool.prestart - Whether all core threads should be prestarted.threadFactory - The factory to use when the executor creates a new
thread.public void execute(java.lang.Runnable task)
execute in interface java.util.concurrent.Executorexecute in class AFThreadPoolExecutorprotected void afterExecute(java.lang.Runnable r,
java.lang.Throwable t)
afterExecute in class AFThreadPoolExecutor