Class NativeWorkerPool
- java.lang.Object
-
- org.apache.axis2.transport.base.threads.NativeWorkerPool
-
- All Implemented Interfaces:
WorkerPool
public class NativeWorkerPool extends Object implements WorkerPool
Worker pool implementation based on java.util.concurrent in JDK 1.5 or later.
-
-
Constructor Summary
Constructors Constructor 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(Runnable task)Asynchronously execute the given task using one of the threads of the worker pool.intgetActiveCount()intgetQueueSize()voidshutdown(int timeout)Destroy the worker pool.
-
-
-
Constructor Detail
-
NativeWorkerPool
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, String threadGroupName, String threadGroupId)
-
NativeWorkerPool
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, String threadGroupName, String threadGroupId, BlockingQueue<Runnable> queue)
-
NativeWorkerPool
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, String threadGroupName, String threadGroupId, BlockingQueue<Runnable> queue, RejectedExecutionHandler rejectedExecutionHandler)
-
NativeWorkerPool
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, int waterMark, String threadGroupName, String threadGroupId)
-
NativeWorkerPool
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, int waterMark, String threadGroupName, String threadGroupId, WaterMarkQueue<Runnable> queue)
-
NativeWorkerPool
public NativeWorkerPool(int core, int max, int keepAlive, int queueLength, int waterMark, String threadGroupName, String threadGroupId, RejectedExecutionHandler rejectedExecutionHandler)
-
-
Method Detail
-
execute
public void execute(Runnable task)
Description copied from interface:WorkerPoolAsynchronously execute the given task using one of the threads of the worker pool. The task is expected to terminate gracefully, i.e.Runnable.run()should not throw an exception. Any uncaught exceptions should be logged by the worker pool implementation.- Specified by:
executein interfaceWorkerPool- Parameters:
task- the task to execute
-
getActiveCount
public int getActiveCount()
- Specified by:
getActiveCountin interfaceWorkerPool
-
getQueueSize
public int getQueueSize()
- Specified by:
getQueueSizein interfaceWorkerPool
-
shutdown
public void shutdown(int timeout) throws InterruptedExceptionDescription copied from interface:WorkerPoolDestroy the worker pool. The pool will immediately stop accepting new tasks. All previously submitted tasks will be executed. The method blocks until all tasks have completed execution, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Specified by:
shutdownin interfaceWorkerPool- Parameters:
timeout- the timeout value in milliseconds- Throws:
InterruptedException- if the current thread was interrupted while waiting for pending tasks to finish execution
-
-