org.jboss.jms.server.plugin
Class DefaultThreadPool

java.lang.Object
  extended byServiceMBeanSupport
      extended byorg.jboss.jms.server.plugin.DefaultThreadPool
All Implemented Interfaces:
ServerPlugin, ThreadPool

public class DefaultThreadPool
extends ServiceMBeanSupport
implements ThreadPool

A thread pool implementation based on Doug Lea's PooledExecutor. The buffer(queue) of the pool must be unbounded to avoid potential distributed deadlock. Since the buffer is unbounded, the minimum pool size has to be the same as the maximum. Otherwise, we will never have more than getMinimumPoolSize threads running.

Version:
$Revision: 1.2 $ $Id: DefaultThreadPool.java,v 1.2 2006/01/26 00:20:30 ovidiu Exp $
Author:
Ovidiu Feodorov
See Also:
Serialized Form

Field Summary
protected  PooledExecutor executor
           
 
Constructor Summary
DefaultThreadPool(int size)
           
 
Method Summary
 void execute(java.lang.Runnable runnable)
           
 java.lang.Object getInstance()
          A server plugin will be always accessed via a hard reference, so it is essential that each implementation exposes this method.
 int getSize()
          Managed attribute.
 void setSize(int i)
          Managed attribute.
protected  void startService()
           
protected  void stopService()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

executor

protected PooledExecutor executor
Constructor Detail

DefaultThreadPool

public DefaultThreadPool(int size)
Method Detail

startService

protected void startService()
                     throws java.lang.Exception
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Throws:
java.lang.Exception

getInstance

public java.lang.Object getInstance()
Description copied from interface: ServerPlugin
A server plugin will be always accessed via a hard reference, so it is essential that each implementation exposes this method.

Specified by:
getInstance in interface ServerPlugin

execute

public void execute(java.lang.Runnable runnable)
             throws java.lang.InterruptedException
Specified by:
execute in interface ThreadPool
Throws:
java.lang.InterruptedException

setSize

public void setSize(int i)
Managed attribute.


getSize

public int getSize()
Managed attribute.



Copyright © 2006 JBoss Inc. All Rights Reserved.