public class BlockingExecutor extends ThreadPoolExecutor
Based on the BoundedExecutor example in: Brian Goetz, 2006. Java Concurrency in Practice. (Listing 8.4)
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
BlockingExecutor(int poolSize,
int queueSize)
Creates a BlockingExecutor which will block and prevent further submission to the pool when the specified queue
size has been reached.
|
Modifier and Type | Method and Description |
---|---|
void |
afterExecute(Runnable r,
Throwable t)
Method invoked upon completion of execution of the given Runnable, by the thread that executed the task.
|
void |
execute(Runnable task)
Executes the given task.
|
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, 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, toString
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
public BlockingExecutor(int poolSize, int queueSize)
poolSize
- the number of the threads in the poolqueueSize
- the size of the queuepublic void execute(Runnable task)
execute
in interface Executor
execute
in class ThreadPoolExecutor
public void afterExecute(Runnable r, Throwable t)
afterExecute
in class ThreadPoolExecutor
Copyright © 2015 WSO2, Inc.. All Rights Reserved.