org.apache.avalon.cornerstone.blocks.threads
Class AbstractThreadManager

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.avalon.cornerstone.blocks.threads.AbstractThreadManager
All Implemented Interfaces:
org.apache.avalon.cornerstone.services.threads.ThreadManager, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled
Direct Known Subclasses:
DefaultThreadManager, ResourceLimitingThreadManager

public abstract class AbstractThreadManager
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.avalon.cornerstone.services.threads.ThreadManager, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Disposable

Abstract implementation of ThreadManager.

Author:
Avalon Development Team

Field Summary
private  java.util.HashMap m_threadPools
           
 
Fields inherited from interface org.apache.avalon.cornerstone.services.threads.ThreadManager
ROLE
 
Constructor Summary
AbstractThreadManager()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Setup thread pools based on configuration data.
protected abstract  void configureThreadPool(java.util.Map threadPools, org.apache.avalon.framework.configuration.Configuration configuration)
           
 void dispose()
           
 org.apache.excalibur.thread.ThreadPool getDefaultThreadPool()
          Retrieve the default thread pool.
 org.apache.excalibur.thread.ThreadPool getThreadPool(java.lang.String name)
          Retrieve a thread pool by name.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_threadPools

private java.util.HashMap m_threadPools
Constructor Detail

AbstractThreadManager

public AbstractThreadManager()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Setup thread pools based on configuration data.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration - the configuration data
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - if an error occurs

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

configureThreadPool

protected abstract void configureThreadPool(java.util.Map threadPools,
                                            org.apache.avalon.framework.configuration.Configuration configuration)
                                     throws org.apache.avalon.framework.configuration.ConfigurationException
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

getThreadPool

public org.apache.excalibur.thread.ThreadPool getThreadPool(java.lang.String name)
                                                     throws java.lang.IllegalArgumentException
Retrieve a thread pool by name.

Specified by:
getThreadPool in interface org.apache.avalon.cornerstone.services.threads.ThreadManager
Parameters:
name - the name of thread pool
Returns:
the threadpool
Throws:
java.lang.IllegalArgumentException - if the name of thread pool is invalid or named pool does not exist

getDefaultThreadPool

public org.apache.excalibur.thread.ThreadPool getDefaultThreadPool()
Retrieve the default thread pool.

Specified by:
getDefaultThreadPool in interface org.apache.avalon.cornerstone.services.threads.ThreadManager
Returns:
the thread pool