org.apache.avalon.excalibur.thread.impl
Class DefaultThreadPool

java.lang.Object
  extended byjava.lang.ThreadGroup
      extended byorg.apache.avalon.excalibur.thread.impl.DefaultThreadPool
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.excalibur.pool.ObjectFactory, org.apache.excalibur.thread.ThreadPool

public class DefaultThreadPool
extends java.lang.ThreadGroup
implements org.apache.avalon.excalibur.pool.ObjectFactory, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.activity.Disposable, org.apache.excalibur.thread.ThreadPool

This class is the public frontend for the thread pool code.

Author:
Avalon Development Team

Constructor Summary
DefaultThreadPool(int capacity)
           
DefaultThreadPool(java.lang.String name, int capacity)
           
DefaultThreadPool(java.lang.String name, int min, int max)
           
 
Method Summary
 void decommission(java.lang.Object object)
           
 void dispose()
           
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
           
 org.apache.excalibur.thread.ThreadControl execute(org.apache.avalon.framework.activity.Executable work)
          Run work in separate thread.
 org.apache.excalibur.thread.ThreadControl execute(org.apache.excalibur.thread.Executable work)
          Run work in separate thread.
 org.apache.excalibur.thread.ThreadControl execute(java.lang.Runnable work)
          Run work in separate thread.
 java.lang.Class getCreatedClass()
           
 java.lang.Object newInstance()
           
 
Methods inherited from class java.lang.ThreadGroup
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString, uncaughtException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultThreadPool

public DefaultThreadPool(int capacity)
                  throws java.lang.Exception

DefaultThreadPool

public DefaultThreadPool(java.lang.String name,
                         int capacity)
                  throws java.lang.Exception

DefaultThreadPool

public DefaultThreadPool(java.lang.String name,
                         int min,
                         int max)
                  throws java.lang.Exception
Method Detail

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled

dispose

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

newInstance

public java.lang.Object newInstance()
Specified by:
newInstance in interface org.apache.avalon.excalibur.pool.ObjectFactory

decommission

public void decommission(java.lang.Object object)
Specified by:
decommission in interface org.apache.avalon.excalibur.pool.ObjectFactory

getCreatedClass

public java.lang.Class getCreatedClass()
Specified by:
getCreatedClass in interface org.apache.avalon.excalibur.pool.ObjectFactory

execute

public org.apache.excalibur.thread.ThreadControl execute(org.apache.avalon.framework.activity.Executable work)
Run work in separate thread. Return a valid ThreadControl to control work thread.

Parameters:
work - the work to be executed.
Returns:
the ThreadControl

execute

public org.apache.excalibur.thread.ThreadControl execute(java.lang.Runnable work)
Run work in separate thread. Return a valid ThreadControl to control work thread.

Specified by:
execute in interface org.apache.excalibur.thread.ThreadPool
Parameters:
work - the work to be executed.
Returns:
the ThreadControl

execute

public org.apache.excalibur.thread.ThreadControl execute(org.apache.excalibur.thread.Executable work)
Run work in separate thread. Return a valid ThreadControl to control work thread.

Specified by:
execute in interface org.apache.excalibur.thread.ThreadPool
Parameters:
work - the work to be executed.
Returns:
the ThreadControl


Copyright © 2001-2005 The Apache Software Foundation. All Rights Reserved.