org.exolab.jms.common.threads
Class ThreadPool

java.lang.Object
  |
  +--EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
        |
        +--EDU.oswego.cs.dl.util.concurrent.PooledExecutor
              |
              +--org.exolab.jms.common.threads.ThreadPool
All Implemented Interfaces:
EDU.oswego.cs.dl.util.concurrent.Executor

public class ThreadPool
extends EDU.oswego.cs.dl.util.concurrent.PooledExecutor

Thread pool.

Version:
$Revision: 1.2 $ $Date: 2006/02/23 11:07:05 $
Author:
Tim Anderson

Inner classes 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
 
Inner classes inherited from class EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser
EDU.oswego.cs.dl.util.concurrent.ThreadFactoryUser.DefaultThreadFactory
 
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_
 
Constructor Summary
ThreadPool(java.lang.String name, EDU.oswego.cs.dl.util.concurrent.Channel channel, int maxPoolSize)
          Construct a new ThreadPool.
ThreadPool(java.lang.String name, EDU.oswego.cs.dl.util.concurrent.Channel channel, int maxPoolSize, boolean daemon)
          Construct a new ThreadPool.
ThreadPool(java.lang.String name, int maxPoolSize)
          Construct a new ThreadPool.
ThreadPool(java.lang.String name, int maxPoolSize, boolean daemon)
          Construct a new ThreadPool.
ThreadPool(java.lang.ThreadGroup group, java.lang.String name, EDU.oswego.cs.dl.util.concurrent.Channel channel, int maxPoolSize, boolean daemon)
          Construct a new ThreadPool.
ThreadPool(java.lang.ThreadGroup group, java.lang.String name, int maxPoolSize)
          Construct a new ThreadPool.
 
Method Summary
 void execute(java.lang.Runnable command)
          Arrange for the given command to be executed by a thread in this pool.
 void setThreadListener(ThreadListener listener)
          Sets a listener to be notified when a thread processes a command.
 
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
 

Constructor Detail

ThreadPool

public ThreadPool(java.lang.String name,
                  int maxPoolSize)
Construct a new ThreadPool.
Parameters:
name - the name to assign the thread group and worker threads
maxPoolSize - the maximum no. of threads to use

ThreadPool

public ThreadPool(java.lang.String name,
                  EDU.oswego.cs.dl.util.concurrent.Channel channel,
                  int maxPoolSize)
Construct a new ThreadPool.
Parameters:
name - the name to assign the thread group and worker threads
channel - the channel for queueing
maxPoolSize - the maximum no. of threads to use

ThreadPool

public ThreadPool(java.lang.String name,
                  int maxPoolSize,
                  boolean daemon)
Construct a new ThreadPool.
Parameters:
name - the name of the pool
maxPoolSize - the maximum no. of threads to use
daemon - if true all threads will be daemon threads

ThreadPool

public ThreadPool(java.lang.String name,
                  EDU.oswego.cs.dl.util.concurrent.Channel channel,
                  int maxPoolSize,
                  boolean daemon)
Construct a new ThreadPool.
Parameters:
name - the name of the pool
channel - the channel for queueing
maxPoolSize - the maximum no. of threads to use
daemon - if true all threads will be daemon threads

ThreadPool

public ThreadPool(java.lang.ThreadGroup group,
                  java.lang.String name,
                  int maxPoolSize)
Construct a new ThreadPool.
Parameters:
group - the thread group. May be null
name - the name to assign worker threads
maxPoolSize - the maximum no. of threads to use

ThreadPool

public ThreadPool(java.lang.ThreadGroup group,
                  java.lang.String name,
                  EDU.oswego.cs.dl.util.concurrent.Channel channel,
                  int maxPoolSize,
                  boolean daemon)
Construct a new ThreadPool.
Parameters:
group - the thread group. May be null
name - the name to assign worker threads
channel - the channel for queueing
maxPoolSize - the maximum no. of threads to use
daemon - if true all threads will be daemon threads
Method Detail

setThreadListener

public void setThreadListener(ThreadListener listener)
Sets a listener to be notified when a thread processes a command.
Parameters:
listener - the listener

execute

public void execute(java.lang.Runnable command)
             throws java.lang.InterruptedException
Arrange for the given command to be executed by a thread in this pool. The method normally returns when the command has been handed off for (possibly later) execution.
Overrides:
execute in class EDU.oswego.cs.dl.util.concurrent.PooledExecutor


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.