FileDocCategorySizeDatePackage
ThreadManagerFactory.javaAPI DocJBoss 4.2.14525Fri Jul 13 21:02:30 BST 2007org.jboss.aspects.asynchronous.concurrent

ThreadManagerFactory

public class ThreadManagerFactory extends Object
author
{Claude Hussenet Independent Consultant}.
version
$Revision: 57186 $

Fields Summary
protected org.jboss.aspects.asynchronous.ThreadManager
threadManager
protected String
DEFAULT_MIN_THREAD
protected String
DEFAULT_MAX_THREAD
protected String
DEFAULT_KEEP_ALIVE
protected String
DEFAULT_IS_WAITING_WHEN_POOLSIZE_FULL
protected String
DEFAULT_IS_POOLING
protected static String
MIN_POOL_SIZE
protected static String
MAX_POOL_SIZE
protected static String
KEEP_ALIVE
protected static String
IS_WAITING_WHEN_POOLSIZE_FULL
protected static String
IS_POOLING
protected static String
PROPERTY_FILE
protected static final ThreadManagerFactory
threadManagerFactory
protected static ResourceBundle
rb
Constructors Summary
protected ThreadManagerFactory()


      initResourceBundle();

      threadManager = new ThreadManagerImpl();

      threadManager.setMinimumPoolSize(Integer.parseInt(getString(MIN_POOL_SIZE, DEFAULT_MIN_THREAD)));

      threadManager.setMaximumPoolSize(Integer.parseInt(getString(MAX_POOL_SIZE, DEFAULT_MAX_THREAD)));

      threadManager.setKeepAliveTime(Integer.parseInt(getString(KEEP_ALIVE, DEFAULT_KEEP_ALIVE)));

      threadManager.setWaitWhenPoolSizeIsFull(Boolean

      .valueOf(getString(IS_WAITING_WHEN_POOLSIZE_FULL,

      DEFAULT_IS_WAITING_WHEN_POOLSIZE_FULL))

      .booleanValue());


      threadManager.setPooling(Boolean

      .valueOf(getString(IS_POOLING,

      DEFAULT_IS_POOLING))

      .booleanValue());

   
Methods Summary
public static org.jboss.aspects.asynchronous.ThreadManagerRequestcreateNewThreadManagerRequest(java.lang.String id, org.jboss.aspects.asynchronous.AsynchronousParameters inputParameters, org.jboss.aspects.asynchronous.AsynchronousUserTask taskClassNameImpl, long timeout)


      return new ThreadManagerRequestImpl(id,

      inputParameters,

      taskClassNameImpl,

      timeout);

   
private static java.lang.StringgetString(java.lang.String key, java.lang.String defaultValue)


      try
      {

         if (rb == null)

            return defaultValue;

         String value = rb.getString(key);

         if (value == null)

            return defaultValue;

         else

            return value;

      }
      catch (Exception e)
      {}

      return defaultValue;

   
public static org.jboss.aspects.asynchronous.ThreadManagergetThreadManager()


      return threadManagerFactory.threadManager;

   
static voidinitResourceBundle()


     
   

      try
      {

         rb = ResourceBundle.getBundle(PROPERTY_FILE);

      }
      catch (Exception e)
      {

         //System.err.println(e.getMessage());

      }