org.apache.axis2.transport.base.threads
Class NativeWorkerPool

java.lang.Object
  extended by org.apache.axis2.transport.base.threads.NativeWorkerPool
All Implemented Interfaces:
WorkerPool

public class NativeWorkerPool
extends java.lang.Object
implements WorkerPool

Worker pool implementation based on java.util.concurrent in JDK 1.5 or later.


Constructor Summary
NativeWorkerPool(int core, int max, int keepAlive, int queueLength, java.lang.String threadGroupName, java.lang.String threadGroupId)
           
 
Method Summary
 void execute(java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeWorkerPool

public NativeWorkerPool(int core,
                        int max,
                        int keepAlive,
                        int queueLength,
                        java.lang.String threadGroupName,
                        java.lang.String threadGroupId)
Method Detail

execute

public void execute(java.lang.Runnable task)
Description copied from interface: WorkerPool
Asynchronously 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:
execute in interface WorkerPool
Parameters:
task - the task to execute

getActiveCount

public int getActiveCount()
Specified by:
getActiveCount in interface WorkerPool

getQueueSize

public int getQueueSize()
Specified by:
getQueueSize in interface WorkerPool

shutdown

public void shutdown(int timeout)
              throws java.lang.InterruptedException
Description copied from interface: WorkerPool
Destroy 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:
shutdown in interface WorkerPool
Parameters:
timeout - the timeout value in milliseconds
Throws:
java.lang.InterruptedException - if the current thread was interrupted while waiting for pending tasks to finish execution


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.