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, toString
public QueuedThreadPool(int coreSize, int maxSize)
coreSize
- Core pool sizemaxSize
- Maximum pool sizepublic int getCorePoolSize()
getCorePoolSize
in class java.util.concurrent.ThreadPoolExecutor
public void setCorePoolSize(int coreSize)
setCorePoolSize
in class java.util.concurrent.ThreadPoolExecutor
coreSize
- Core pool sizepublic int getMaximumPoolSize()
getMaximumPoolSize
in class java.util.concurrent.ThreadPoolExecutor
public void setMaximumPoolSize(int maxSize)
setMaximumPoolSize
in class java.util.concurrent.ThreadPoolExecutor
maxSize
- Maximum pool sizepublic void execute(java.lang.Runnable task) throws java.util.concurrent.RejectedExecutionException
execute
in interface java.util.concurrent.Executor
execute
in class java.util.concurrent.ThreadPoolExecutor
task
- 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.ExecutorService
submit
in class java.util.concurrent.AbstractExecutorService
task
- 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.ExecutorService
submit
in class java.util.concurrent.AbstractExecutorService
T
- 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.ExecutorService
submit
in class java.util.concurrent.AbstractExecutorService
T
- 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.ThreadPoolExecutor
task
- Runnable taskexc
- Thrown exception