org.apache.cocoon.components.thread
Class DefaultThreadPool

java.lang.Object
  extended by EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
      extended by EDU.oswego.cs.dl.util.concurrent.PooledExecutor
          extended by org.apache.cocoon.components.thread.DefaultThreadPool
All Implemented Interfaces:
EDU.oswego.cs.dl.util.concurrent.Executor, LogEnabled, ThreadPool

public class DefaultThreadPool
extends EDU.oswego.cs.dl.util.concurrent.PooledExecutor
implements ThreadPool, LogEnabled

The DefaultThreadPool class implements the ThreadPool interface. Instances of this class are made by the RunnableManager passing a configuration into the configure method.

Version:
CVS $Id: DefaultThreadPool.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Giacomo Pati

Nested Class Summary
 
Nested classes/interfaces inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor
EDU.oswego.cs.dl.util.concurrent.PooledExecutor.AbortWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.BlockedExecutionHandler, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.DiscardOldestWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.DiscardWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.RunWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.WaitWhenBlocked, EDU.oswego.cs.dl.util.concurrent.PooledExecutor.Worker
 
Nested classes/interfaces inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser.DefaultThreadFactory
 
Field Summary
static String POLICY_DEFAULT
          Default ThreadPool block policy
 
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor
blockedExecutionHandler_, DEFAULT_KEEPALIVETIME, DEFAULT_MAXIMUMPOOLSIZE, DEFAULT_MINIMUMPOOLSIZE, handOff_, keepAliveTime_, maximumPoolSize_, minimumPoolSize_, poolSize_, shutdown_, threads_
 
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
threadFactory_
 
Fields inherited from interface org.apache.cocoon.components.thread.ThreadPool
POLICY_ABORT, POLICY_DISCARD, POLICY_DISCARD_OLDEST, POLICY_RUN, POLICY_WAIT, ROLE
 
Method Summary
 void enableLogging(Logger logger)
          Set the logger
 void execute(Runnable command)
          Execute a command
 String getBlockPolicy()
          DOCUMENT ME!
 int getMaximumQueueSize()
          DOCUMENT ME!
 int getMaxQueueSize()
          DOCUMENT ME!
 String getName()
          The Name of this thread pool
 int getPriority()
          Get hte priority used to create Threads
 int getQueueSize()
          DOCUMENT ME!
 boolean isQueued()
          Whether this DefaultThreadPool has a queue
 void shutdown()
          Terminates all threads possibly awaiting processing all elements currently in queue.
 
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.PooledExecutor
abortWhenBlocked, addThread, awaitTerminationAfterShutdown, awaitTerminationAfterShutdown, createThreads, discardOldestWhenBlocked, discardWhenBlocked, drain, getBlockedExecutionHandler, getKeepAliveTime, getMaximumPoolSize, getMinimumPoolSize, getPoolSize, getTask, interruptAll, isTerminatedAfterShutdown, runWhenBlocked, setBlockedExecutionHandler, setKeepAliveTime, setMaximumPoolSize, setMinimumPoolSize, shutdownAfterProcessingCurrentlyQueuedTasks, shutdownAfterProcessingCurrentlyQueuedTasks, shutdownNow, shutdownNow, waitWhenBlocked, workerDone
 
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
getThreadFactory, setThreadFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.components.thread.ThreadPool
getKeepAliveTime, getMaximumPoolSize, getMinimumPoolSize, getPoolSize, isTerminatedAfterShutdown
 

Field Detail

POLICY_DEFAULT

public static final String POLICY_DEFAULT
Default ThreadPool block policy

See Also:
Constant Field Values
Method Detail

getBlockPolicy

public String getBlockPolicy()
DOCUMENT ME!

Specified by:
getBlockPolicy in interface ThreadPool
Returns:
Returns the blockPolicy.

getMaxQueueSize

public int getMaxQueueSize()
DOCUMENT ME!

Returns:
maximum size of the queue (0 if isQueued() == false)
See Also:
ThreadPool.getQueueSize()

getMaximumQueueSize

public int getMaximumQueueSize()
DOCUMENT ME!

Specified by:
getMaximumQueueSize in interface ThreadPool
Returns:
size of queue (0 if isQueued() == false)
See Also:
ThreadPool.getQueueSize()

getName

public String getName()
Description copied from interface: ThreadPool
The Name of this thread pool

Specified by:
getName in interface ThreadPool
Returns:
The name
See Also:
ThreadPool.getName()

getPriority

public int getPriority()
Get hte priority used to create Threads

Specified by:
getPriority in interface ThreadPool
Returns:
Thread.MIN_PRIORITY, Thread.NORM_PRIORITY, or Thread.MAX_PRIORITY

getQueueSize

public int getQueueSize()
DOCUMENT ME!

Specified by:
getQueueSize in interface ThreadPool
Returns:
current size of the queue (0 if isQueued() == false)
See Also:
ThreadPool.getQueueSize()

isQueued

public boolean isQueued()
Whether this DefaultThreadPool has a queue

Specified by:
isQueued in interface ThreadPool
Returns:
Returns the m_isQueued.
See Also:
ThreadPool.isQueued()

enableLogging

public void enableLogging(Logger logger)
Set the logger

Specified by:
enableLogging in interface LogEnabled
Parameters:
logger -
See Also:
LogEnabled.enableLogging(org.apache.avalon.framework.logger.Logger)

execute

public void execute(Runnable command)
             throws InterruptedException
Execute a command

Specified by:
execute in interface EDU.oswego.cs.dl.util.concurrent.Executor
Specified by:
execute in interface ThreadPool
Overrides:
execute in class EDU.oswego.cs.dl.util.concurrent.PooledExecutor
Parameters:
command - The Runnable to execute
Throws:
InterruptedException - In case of interruption

shutdown

public void shutdown()
Description copied from interface: ThreadPool
Terminates all threads possibly awaiting processing all elements currently in queue.

Specified by:
shutdown in interface ThreadPool
See Also:
ThreadPool.shutdown()


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.