org.apache.geronimo.connector.work.pool
Class WorkExecutorPoolImpl

java.lang.Object
  extended byorg.apache.geronimo.connector.work.pool.WorkExecutorPoolImpl
All Implemented Interfaces:
EDU.oswego.cs.dl.util.concurrent.Executor, WorkExecutorPool

public class WorkExecutorPoolImpl
extends Object
implements WorkExecutorPool

Based class for WorkExecutorPool. Sub-classes define the synchronization policy (should the call block until the end of the work; or when it starts et cetera).

Version:
$Rev: 355877 $ $Date: 2005-12-11 03:48:27 +0100 (Sun, 11 Dec 2005) $

Constructor Summary
WorkExecutorPoolImpl(EDU.oswego.cs.dl.util.concurrent.Channel channel, int maxSize)
          Creates a pool with the specified minimum and maximum sizes and using the specified Channel to enqueue the submitted Work instances.
WorkExecutorPoolImpl(int maxSize)
          Creates a pool with the specified minimum and maximum sizes.
 
Method Summary
 void execute(Runnable work)
          Execute the specified Work.
 int getMaximumPoolSize()
          Gets the maximum size of this pool.
 int getPoolSize()
          Gets the size of this pool.
 void setMaximumPoolSize(int maxSize)
          Sets the maximum size of this pool.
 WorkExecutorPool start()
           
 WorkExecutorPool stop()
          Stops this pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkExecutorPoolImpl

public WorkExecutorPoolImpl(int maxSize)
Creates a pool with the specified minimum and maximum sizes. The Channel used to enqueue the submitted Work instances is queueless synchronous one.

Parameters:
maxSize - Maximum size of the work executor pool.

WorkExecutorPoolImpl

public WorkExecutorPoolImpl(EDU.oswego.cs.dl.util.concurrent.Channel channel,
                            int maxSize)
Creates a pool with the specified minimum and maximum sizes and using the specified Channel to enqueue the submitted Work instances.

Parameters:
channel - Queue to be used as the queueing facility of this pool.
maxSize - Maximum size of the work executor pool.
Method Detail

execute

public void execute(Runnable work)
             throws InterruptedException
Execute the specified Work.

Specified by:
execute in interface EDU.oswego.cs.dl.util.concurrent.Executor
Parameters:
work - Work to be executed.
Throws:
InterruptedException - Indicates that the Work execution has been unsuccessful.

getPoolSize

public int getPoolSize()
Gets the size of this pool.

Specified by:
getPoolSize in interface WorkExecutorPool
Returns:
Number of active threads in the pool.

getMaximumPoolSize

public int getMaximumPoolSize()
Gets the maximum size of this pool.

Specified by:
getMaximumPoolSize in interface WorkExecutorPool
Returns:
Maximum size.

setMaximumPoolSize

public void setMaximumPoolSize(int maxSize)
Sets the maximum size of this pool.

Specified by:
setMaximumPoolSize in interface WorkExecutorPool
Parameters:
maxSize - New maximum size of this pool.

start

public WorkExecutorPool start()
Specified by:
start in interface WorkExecutorPool

stop

public WorkExecutorPool stop()
Stops this pool. Prior to stop this pool, all the enqueued Work instances are processed. This is an orderly shutdown.

Specified by:
stop in interface WorkExecutorPool


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.