org.mule.impl.work
Class WorkExecutorPoolImpl

java.lang.Object
  extended byorg.mule.impl.work.WorkExecutorPoolImpl
All Implemented Interfaces:
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: 3798 $ $Date: 2006-11-03 22:07:14 -0600 (Fri, 03 Nov 2006) $

Constructor Summary
WorkExecutorPoolImpl(BlockingQueue queue, int maxSize)
          Creates a pool with the specified minimum and maximum sizes and using the specified Channel to enqueue the submitted Work instances.
WorkExecutorPoolImpl(ThreadingProfile profile, String name)
          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(ThreadingProfile profile,
                            String name)
Creates a pool with the specified minimum and maximum sizes. The Channel used to enqueue the submitted Work instances is queueless synchronous one.

Parameters:
profile - The threading profile to use when creating a pool for this work manager
name - The name to associate with the threads created in this pool

WorkExecutorPoolImpl

public WorkExecutorPoolImpl(BlockingQueue queue,
                            int maxSize)
Creates a pool with the specified minimum and maximum sizes and using the specified Channel to enqueue the submitted Work instances.

Parameters:
queue - 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)
Execute the specified Work.

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, if possible, in the allowed timeout. After what, all threads are interrupted and waited for. This is an mix orderly / abrupt shutdown.

Specified by:
stop in interface WorkExecutorPool


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.