Interface ResizableExecutor

All Superinterfaces:
Executor
All Known Implementing Classes:
StandardThreadExecutor

public interface ResizableExecutor extends Executor
Executor that supports dynamic resizing of the thread pool and queue.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the approximate number of threads that are actively executing tasks.
    int
    Returns the maximum number of threads in the pool.
    int
    Returns the current number of threads in the pool.
    boolean
    resizePool(int corePoolSize, int maximumPoolSize)
    Resize the thread pool.
    boolean
    resizeQueue(int capacity)
    Resize the work queue.

    Methods inherited from interface Executor

    execute
  • Method Details

    • getPoolSize

      int getPoolSize()
      Returns the current number of threads in the pool.
      Returns:
      the number of threads
    • getMaxThreads

      int getMaxThreads()
      Returns the maximum number of threads in the pool.
      Returns:
      the maximum number of threads
    • getActiveCount

      int getActiveCount()
      Returns the approximate number of threads that are actively executing tasks.
      Returns:
      the number of threads
    • resizePool

      boolean resizePool(int corePoolSize, int maximumPoolSize)
      Resize the thread pool.
      Parameters:
      corePoolSize - The new core pool size
      maximumPoolSize - The new maximum pool size
      Returns:
      True if the pool was resized successfully
    • resizeQueue

      boolean resizeQueue(int capacity)
      Resize the work queue.
      Parameters:
      capacity - The new queue capacity
      Returns:
      True if the queue was resized successfully