public class QueuedThreadPool
extends java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy| Constructor and Description |
|---|
QueuedThreadPool(int coreSize,
int maxSize)
Create the queued thread pool
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterExecute(java.lang.Runnable task,
java.lang.Throwable exc)
Process task completion
|
void |
execute(java.lang.Runnable task)
Execute a task
|
int |
getCorePoolSize()
Return the core pool size
|
int |
getMaximumPoolSize()
Return the maximum pool size
|
void |
setCorePoolSize(int coreSize)
Set the core pool size
|
void |
setMaximumPoolSize(int maxSize)
Set the maximum pool size
|
<T> java.util.concurrent.Future<T> |
submit(java.util.concurrent.Callable<T> callable)
Submit a task for execution
|
java.util.concurrent.Future<?> |
submit(java.lang.Runnable task)
Submit a task for execution
|
<T> java.util.concurrent.Future<T> |
submit(java.lang.Runnable task,
T result)
Submit a task for execution
|
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getKeepAliveTime, getLargestPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setKeepAliveTime, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toStringpublic QueuedThreadPool(int coreSize,
int maxSize)
coreSize - Core pool sizemaxSize - Maximum pool sizepublic int getCorePoolSize()
getCorePoolSize in class java.util.concurrent.ThreadPoolExecutorpublic void setCorePoolSize(int coreSize)
setCorePoolSize in class java.util.concurrent.ThreadPoolExecutorcoreSize - Core pool sizepublic int getMaximumPoolSize()
getMaximumPoolSize in class java.util.concurrent.ThreadPoolExecutorpublic void setMaximumPoolSize(int maxSize)
setMaximumPoolSize in class java.util.concurrent.ThreadPoolExecutormaxSize - Maximum pool sizepublic void execute(java.lang.Runnable task)
throws java.util.concurrent.RejectedExecutionException
execute in interface java.util.concurrent.Executorexecute in class java.util.concurrent.ThreadPoolExecutortask - Taskjava.util.concurrent.RejectedExecutionException - Unable to execute taskpublic java.util.concurrent.Future<?> submit(java.lang.Runnable task)
throws java.util.concurrent.RejectedExecutionException
submit in interface java.util.concurrent.ExecutorServicesubmit in class java.util.concurrent.AbstractExecutorServicetask - Runnable taskjava.util.concurrent.RejectedExecutionException - Unable to execute taskpublic <T> java.util.concurrent.Future<T> submit(java.lang.Runnable task,
T result)
throws java.util.concurrent.RejectedExecutionException
submit in interface java.util.concurrent.ExecutorServicesubmit in class java.util.concurrent.AbstractExecutorServiceT - Result typetask - Runnable taskresult - Result returned when task completesjava.util.concurrent.RejectedExecutionException - Unable to execute taskpublic <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> callable)
throws java.util.concurrent.RejectedExecutionException
submit in interface java.util.concurrent.ExecutorServicesubmit in class java.util.concurrent.AbstractExecutorServiceT - Result typecallable - Callable taskjava.util.concurrent.RejectedExecutionException - Unable to execute taskprotected void afterExecute(java.lang.Runnable task,
java.lang.Throwable exc)
afterExecute in class java.util.concurrent.ThreadPoolExecutortask - Runnable taskexc - Thrown exception