Class ScalingThreadPoolExecutor

  • All Implemented Interfaces:
    Executor, ExecutorService

    public final class ScalingThreadPoolExecutor
    extends ThreadPoolExecutor
    A ThreadPoolExecutor that internally uses a ScalingThreadPoolExecutor.ScalingLinkedBlockingQueue to manage scheduled tasks. This allows us to manage a dynamically sized thread pool that actually spawns new threads when the pool still allows for it.

    Additionally, this implementation keeps track of the current number of active threads by using an AtomicInteger counter, rather than querying its list of worker threads.

    For further information, see this blog post.