Class BlockingThreadPoolExecutor

  • All Implemented Interfaces:
    java.util.concurrent.Executor, java.util.concurrent.ExecutorService

    public final class BlockingThreadPoolExecutor
    extends java.util.concurrent.ThreadPoolExecutor

    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 Classes 
      Modifier and Type Class Description
      static interface  BlockingThreadPoolExecutor.ExceptionHandler  
      static class  BlockingThreadPoolExecutor.SilentExceptionHandler  
      • Nested classes/interfaces inherited from class 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 Summary

      Constructors 
      Constructor Description
      BlockingThreadPoolExecutor​(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, java.util.concurrent.TimeUnit theTimeUnit, java.util.concurrent.BlockingQueue<java.lang.Runnable> theWorkQueue, int theBoundedSize)  
      BlockingThreadPoolExecutor​(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, java.util.concurrent.TimeUnit theTimeUnit, java.util.concurrent.BlockingQueue<java.lang.Runnable> theWorkQueue, java.util.concurrent.RejectedExecutionHandler theRejectedExecutionHandler, int theBoundedSize)  
      BlockingThreadPoolExecutor​(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, java.util.concurrent.TimeUnit theTimeUnit, java.util.concurrent.BlockingQueue<java.lang.Runnable> theWorkQueue, java.util.concurrent.ThreadFactory theThreadFactory, int theBoundedSize)  
      BlockingThreadPoolExecutor​(int theCorePoolSize, int theMaxPoolSize, long theKeepAliveTime, java.util.concurrent.TimeUnit theTimeUnit, java.util.concurrent.BlockingQueue<java.lang.Runnable> theWorkQueue, java.util.concurrent.ThreadFactory theThreadFactory, java.util.concurrent.RejectedExecutionHandler theRejectedExecutionHandler, int theBoundedSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void afterExecute​(java.lang.Runnable theRunnable, java.lang.Throwable theThrowable)
      void execute​(java.lang.Runnable task)
      void setExceptionHandler​(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, toString
      • Methods inherited from class java.util.concurrent.AbstractExecutorService

        invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BlockingThreadPoolExecutor

        public BlockingThreadPoolExecutor​(int theCorePoolSize,
                                          int theMaxPoolSize,
                                          long theKeepAliveTime,
                                          java.util.concurrent.TimeUnit theTimeUnit,
                                          java.util.concurrent.BlockingQueue<java.lang.Runnable> theWorkQueue,
                                          int theBoundedSize)
      • BlockingThreadPoolExecutor

        public BlockingThreadPoolExecutor​(int theCorePoolSize,
                                          int theMaxPoolSize,
                                          long theKeepAliveTime,
                                          java.util.concurrent.TimeUnit theTimeUnit,
                                          java.util.concurrent.BlockingQueue<java.lang.Runnable> theWorkQueue,
                                          java.util.concurrent.ThreadFactory theThreadFactory,
                                          int theBoundedSize)
      • BlockingThreadPoolExecutor

        public BlockingThreadPoolExecutor​(int theCorePoolSize,
                                          int theMaxPoolSize,
                                          long theKeepAliveTime,
                                          java.util.concurrent.TimeUnit theTimeUnit,
                                          java.util.concurrent.BlockingQueue<java.lang.Runnable> theWorkQueue,
                                          java.util.concurrent.RejectedExecutionHandler theRejectedExecutionHandler,
                                          int theBoundedSize)
      • BlockingThreadPoolExecutor

        public BlockingThreadPoolExecutor​(int theCorePoolSize,
                                          int theMaxPoolSize,
                                          long theKeepAliveTime,
                                          java.util.concurrent.TimeUnit theTimeUnit,
                                          java.util.concurrent.BlockingQueue<java.lang.Runnable> theWorkQueue,
                                          java.util.concurrent.ThreadFactory theThreadFactory,
                                          java.util.concurrent.RejectedExecutionHandler theRejectedExecutionHandler,
                                          int theBoundedSize)
    • Method Detail

      • execute

        public void execute​(java.lang.Runnable task)
        Specified by:
        execute in interface java.util.concurrent.Executor
        Overrides:
        execute in class java.util.concurrent.ThreadPoolExecutor
      • afterExecute

        protected void afterExecute​(java.lang.Runnable theRunnable,
                                    java.lang.Throwable theThrowable)
        Overrides:
        afterExecute in class java.util.concurrent.ThreadPoolExecutor