Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.mq.threadpool
Class ThreadPool

    java.lang.Object
      org.jboss.mq.threadpool.ThreadPool

public class ThreadPool
extends Object

This is an implementation of a simple thread pool with an embedded work queue.

Version:
  $Revision: 1.1 $
Author:
  Ole Husgaard (osh@sparre.dk)

Constructor Summary
`ThreadPool(String name, ThreadGroup threadGroup, int maxWorkers, boolean daemon)` Create a new thread pool instance.

Method Summary
`void` | `cancelWork(Work work)` Cancel a piece of enqueued work.
`void` | `enqueueWork(Work work)` Enqueue a piece of work for this thread to handle.
`void` | `shutdown()` Shutdown this thread pool.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ThreadPool

    public ThreadPool(String name,
                      ThreadGroup threadGroup,
                      int maxWorkers,
                      boolean daemon)

  Create a new thread pool instance.

Parameters:
  `threadGroup` - The `ThreadGroup` that worker threads in this pool should belong to.
  `maxWorkers` - The maximum number of worker threads in this pool.
  `daemon` - If `true`, worker threads will be created as daemon threads.

Method Detail

### shutdown

    public void shutdown()

  Shutdown this thread pool. This will not return until all enqueued work has been cancelled, and all worker threads have done any work they started and have died.

### enqueueWork

    public void enqueueWork(Work work)

  Enqueue a piece of work for this thread to handle. As soon as a thread becomes available, it will call `Work.doWork()` of the argument. If the pool is shutting down, this method will not enqueue the work, but instead simply return.

  Parameters:
    `work` - The piece of work to be enqueued.

### cancelWork

    public void cancelWork(Work work)

  Cancel a piece of enqueued work.

  Parameters:
    `work` - The piece of work to be cancel.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.