Class BlockingThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
com.complexible.common.util.concurrent.BlockingThreadPoolExecutor
- All Implemented Interfaces:
AutoCloseable,Executor,ExecutorService
ThreadPoolExecutor which has a limited number of outstanding permits for executing tasks and when there
are no more permits left, new tasks will block waiting for a permit to free up instead of throwing
an exception.
- Since:
- 1.1
- Version:
- 3.0
- Author:
- Michael Grove
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic classNested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy -
Constructor Summary
ConstructorsConstructorDescriptionBlockingThreadPoolExecutor(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, TimeUnit theTimeUnit, BlockingQueue<Runnable> theWorkQueue, int theBoundedSize) BlockingThreadPoolExecutor(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, TimeUnit theTimeUnit, BlockingQueue<Runnable> theWorkQueue, RejectedExecutionHandler theRejectedExecutionHandler, int theBoundedSize) BlockingThreadPoolExecutor(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, TimeUnit theTimeUnit, BlockingQueue<Runnable> theWorkQueue, ThreadFactory theThreadFactory, int theBoundedSize) BlockingThreadPoolExecutor(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, TimeUnit theTimeUnit, BlockingQueue<Runnable> theWorkQueue, ThreadFactory theThreadFactory, RejectedExecutionHandler theRejectedExecutionHandler, int theBoundedSize) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterExecute(Runnable theRunnable, Throwable theThrowable) voidvoidsetExceptionHandler(BlockingThreadPoolExecutor.ExceptionHandler theExceptionHandler) Methods inherited from class java.util.concurrent.ThreadPoolExecutor
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, toStringMethods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
close
-
Constructor Details
-
BlockingThreadPoolExecutor
public BlockingThreadPoolExecutor(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, TimeUnit theTimeUnit, BlockingQueue<Runnable> theWorkQueue, int theBoundedSize) -
BlockingThreadPoolExecutor
public BlockingThreadPoolExecutor(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, TimeUnit theTimeUnit, BlockingQueue<Runnable> theWorkQueue, ThreadFactory theThreadFactory, int theBoundedSize) -
BlockingThreadPoolExecutor
public BlockingThreadPoolExecutor(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, TimeUnit theTimeUnit, BlockingQueue<Runnable> theWorkQueue, RejectedExecutionHandler theRejectedExecutionHandler, int theBoundedSize) -
BlockingThreadPoolExecutor
public BlockingThreadPoolExecutor(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, TimeUnit theTimeUnit, BlockingQueue<Runnable> theWorkQueue, ThreadFactory theThreadFactory, RejectedExecutionHandler theRejectedExecutionHandler, int theBoundedSize)
-
-
Method Details
-
setExceptionHandler
-
execute
- Specified by:
executein interfaceExecutor- Overrides:
executein classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecutein classThreadPoolExecutor
-