public class NativeWorkerPool extends Object implements WorkerPool
Constructor and Description |
---|
NativeWorkerPool(int core,
int max,
int keepAlive,
int queueLength,
int waterMark,
String threadGroupName,
String threadGroupId) |
NativeWorkerPool(int core,
int max,
int keepAlive,
int queueLength,
int waterMark,
String threadGroupName,
String threadGroupId,
RejectedExecutionHandler rejectedExecutionHandler) |
NativeWorkerPool(int core,
int max,
int keepAlive,
int queueLength,
int waterMark,
String threadGroupName,
String threadGroupId,
WaterMarkQueue<Runnable> queue) |
NativeWorkerPool(int core,
int max,
int keepAlive,
int queueLength,
String threadGroupName,
String threadGroupId) |
NativeWorkerPool(int core,
int max,
int keepAlive,
int queueLength,
String threadGroupName,
String threadGroupId,
BlockingQueue<Runnable> queue) |
NativeWorkerPool(int core,
int max,
int keepAlive,
int queueLength,
String threadGroupName,
String threadGroupId,
BlockingQueue<Runnable> queue,
RejectedExecutionHandler rejectedExecutionHandler) |
Modifier and Type | Method and Description |
---|---|
void |
execute(Runnable task)
Asynchronously execute the given task using one of the threads of the worker pool.
|
int |
getActiveCount() |
int |
getQueueSize() |
void |
shutdown(int timeout)
Destroy the worker pool.
|
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, String threadGroupName, String threadGroupId)
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, String threadGroupName, String threadGroupId, BlockingQueue<Runnable> queue)
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, String threadGroupName, String threadGroupId, BlockingQueue<Runnable> queue, RejectedExecutionHandler rejectedExecutionHandler)
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, int waterMark, String threadGroupName, String threadGroupId)
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, int waterMark, String threadGroupName, String threadGroupId, WaterMarkQueue<Runnable> queue)
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, int waterMark, String threadGroupName, String threadGroupId, RejectedExecutionHandler rejectedExecutionHandler)
public void execute(Runnable task)
WorkerPool
Runnable.run()
should not
throw an exception. Any uncaught exceptions should be logged by the worker pool
implementation.execute
in interface WorkerPool
task
- the task to executepublic int getActiveCount()
getActiveCount
in interface WorkerPool
public int getQueueSize()
getQueueSize
in interface WorkerPool
public void shutdown(int timeout) throws InterruptedException
WorkerPool
shutdown
in interface WorkerPool
timeout
- the timeout value in millisecondsInterruptedException
- if the current thread was
interrupted while waiting for pending tasks to
finish executionCopyright © 2004–2018 The Apache Software Foundation. All rights reserved.