Package org.apache.tomcat.util.threads
Interface ResizableExecutor
-
- All Superinterfaces:
java.util.concurrent.Executor
- All Known Implementing Classes:
StandardThreadExecutor
public interface ResizableExecutor extends java.util.concurrent.ExecutorExecutor that supports dynamic resizing of the thread pool and queue.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetActiveCount()Returns the approximate number of threads that are actively executing tasks.intgetMaxThreads()Returns the maximum number of threads in the pool.intgetPoolSize()Returns the current number of threads in the pool.booleanresizePool(int corePoolSize, int maximumPoolSize)Resize the thread pool.booleanresizeQueue(int capacity)Resize the work queue.
-
-
-
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 sizemaximumPoolSize- 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
-
-