Interface ResizableExecutor

  • All Superinterfaces:
    java.util.concurrent.Executor
    All Known Implementing Classes:
    StandardThreadExecutor

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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int getActiveCount()
      Returns the approximate number of threads that are actively executing tasks.
      int getMaxThreads()
      Returns the maximum number of threads in the pool.
      int getPoolSize()
      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 java.util.concurrent.Executor

        execute
    • Method Detail

      • 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