org.apache.geronimo.pool
Class ThreadPool

java.lang.Object
  extended by org.apache.geronimo.pool.ThreadPool
All Implemented Interfaces:
Executor, GBeanLifecycle, J2EEManagedObject, StatisticsProvider, GeronimoExecutor, ThreadPool

public class ThreadPool
extends Object
implements GeronimoExecutor, GBeanLifecycle, J2EEManagedObject, StatisticsProvider


Nested Class Summary
static class ThreadPool.PoolStatsImpl
           
 
Field Summary
static GBeanInfo GBEAN_INFO
           
 
Constructor Summary
ThreadPool(int poolSize, String poolName, long keepAliveTime, ClassLoader classLoader, String objectName)
           
 
Method Summary
 boolean awaitTermination(long timeout, TimeUnit unit)
           
 void doFail()
          Fails the GBean.
 void doStart()
          Starts the GBean.
 void doStop()
          Stops the target.
 void execute(Runnable command)
           
 void execute(String consumerName, Runnable runnable)
          Executes work on behalf of a named client.
 int getActiveCount()
           
static GBeanInfo getGBeanInfo()
           
 int getMaximumPoolSize()
          Gets the maximum number of threads allowed for this thread pool
 String getName()
          Gets a human-readable name identifying this object.
 String getObjectName()
          Gets the unique name of this object.
 int getPoolSize()
           
 Stats getStats()
          Gets the statistics collected for this class.
 boolean isEventProvider()
          Determines if this object implemnts the event provider type defined in the J2EE Management specification.
 boolean isStateManageable()
          Determines if this object implements the state manageable type defined in the J2EE Management specification.
 boolean isStatisticsProvider()
          Determines if this object implemnts the statistics provider type defined in the J2EE Management specification.
 boolean isWaitWhenBlocked()
           
 void resetStats()
          Reset the startTime for all statistics
 void setWaitWhenBlocked(boolean wait)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GBEAN_INFO

public static final GBeanInfo GBEAN_INFO
Constructor Detail

ThreadPool

public ThreadPool(int poolSize,
                  String poolName,
                  long keepAliveTime,
                  ClassLoader classLoader,
                  String objectName)
Method Detail

getName

public String getName()
Description copied from interface: GeronimoExecutor
Gets a human-readable name identifying this object.

Specified by:
getName in interface GeronimoExecutor

getObjectName

public String getObjectName()
Description copied from interface: J2EEManagedObject
Gets the unique name of this object. The object name must comply with the ObjectName specification in the JMX specification and the restrictions in the J2EEManagementInterface.

Specified by:
getObjectName in interface J2EEManagedObject
Specified by:
getObjectName in interface GeronimoExecutor
Returns:
the unique name of this object within the server

isEventProvider

public boolean isEventProvider()
Description copied from interface: J2EEManagedObject
Determines if this object implemnts the event provider type defined in the J2EE Management specification.

Specified by:
isEventProvider in interface J2EEManagedObject
Returns:
true if this class also implements the event manageable type; false otherwise

isStateManageable

public boolean isStateManageable()
Description copied from interface: J2EEManagedObject
Determines if this object implements the state manageable type defined in the J2EE Management specification.

Specified by:
isStateManageable in interface J2EEManagedObject
Returns:
true if this class also implements the state manageable type; false otherwise

isStatisticsProvider

public boolean isStatisticsProvider()
Description copied from interface: J2EEManagedObject
Determines if this object implemnts the statistics provider type defined in the J2EE Management specification.

Specified by:
isStatisticsProvider in interface J2EEManagedObject
Returns:
true if this class also implements the statistics provider type; false otherwise

getStats

public Stats getStats()
Description copied from interface: StatisticsProvider
Gets the statistics collected for this class. The first call to this method initializes the startTime for all statistics.

Specified by:
getStats in interface StatisticsProvider
Returns:
gets collected for this class

resetStats

public void resetStats()
Description copied from interface: StatisticsProvider
Reset the startTime for all statistics

Specified by:
resetStats in interface StatisticsProvider

getPoolSize

public int getPoolSize()
Specified by:
getPoolSize in interface ThreadPool

getMaximumPoolSize

public int getMaximumPoolSize()
Description copied from interface: ThreadPool
Gets the maximum number of threads allowed for this thread pool

Specified by:
getMaximumPoolSize in interface ThreadPool

getActiveCount

public int getActiveCount()
Specified by:
getActiveCount in interface ThreadPool

awaitTermination

public boolean awaitTermination(long timeout,
                                TimeUnit unit)
                         throws InterruptedException
Specified by:
awaitTermination in interface ThreadPool
Throws:
InterruptedException

execute

public void execute(Runnable command)
Specified by:
execute in interface Executor

execute

public void execute(String consumerName,
                    Runnable runnable)
Description copied from interface: ThreadPool
Executes work on behalf of a named client. This helps the thread pool track who's using its threads.

Specified by:
execute in interface ThreadPool
Parameters:
consumerName - A name identifying the caller, to be used in the management statistics for this pool, etc.
runnable - The work to be done by a thread in the pool

setWaitWhenBlocked

public void setWaitWhenBlocked(boolean wait)

isWaitWhenBlocked

public boolean isWaitWhenBlocked()

doStart

public void doStart()
             throws Exception
Description copied from interface: GBeanLifecycle
Starts the GBean. This informs the GBean that it is about to transition to the running state.

Specified by:
doStart in interface GBeanLifecycle
Throws:
Exception - if the target failed to start; this will cause a transition to the failed state

doStop

public void doStop()
            throws Exception
Description copied from interface: GBeanLifecycle
Stops the target. This informs the GBean that it is about to transition to the stopped state.

Specified by:
doStop in interface GBeanLifecycle
Throws:
Exception - if the target failed to stop; this will cause a transition to the failed state

doFail

public void doFail()
Description copied from interface: GBeanLifecycle
Fails the GBean. This informs the GBean that it is about to transition to the failed state.

Specified by:
doFail in interface GBeanLifecycle

getGBeanInfo

public static GBeanInfo getGBeanInfo()


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.