Protomatter Software v1.1.7

com.protomatter.util
Class WorkQueue

java.lang.Object
  |
  +--com.protomatter.pool.SimpleObjectPool
        |
        +--com.protomatter.pool.GrowingObjectPool
              |
              +--com.protomatter.util.WorkQueue
All Implemented Interfaces:
ObjectPool

public final class WorkQueue
extends GrowingObjectPool

A work queue. Items of work (runnables) are added, and a pool of threads works them off in the background.


Fields inherited from class com.protomatter.pool.SimpleObjectPool
sync
 
Constructor Summary
WorkQueue(int numThreads)
          Create a new workqueue with the given number of worker threads.
WorkQueue(java.lang.String name, int numThreads)
          Create a new workqueue with the given number of worker threads.
 
Method Summary
 void addWork(java.lang.Runnable r)
          Add a runnable to the list of things to do.
 ObjectPoolObject createObjectPoolObject()
          To be implemented by sub-classes.
 int getNumThreads()
          Get the number of worker threads associated with this WorkQueue.
 int getNumWorkers()
          Get the number of threads that are currently performing work.
 int getQueueLength()
          Get the length of the queue (number of work elements yet to be processed).
 
Methods inherited from class com.protomatter.pool.GrowingObjectPool
checkinPoolObject, getCreateWaitTime, getCurrentPoolSize, getInitialObjectPoolSize, getMaxObjectPoolSize, getNextPoolObject, getObjectPoolGrowSize, getObjectPoolSize, getPool, init, reInitializeObjectPool, setMaxObjectPoolSize
 
Methods inherited from class com.protomatter.pool.SimpleObjectPool
checkin, checkout, getCheckedOutObjects, getNumWaiters, getObjectsInUse, getSyncObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkQueue

public WorkQueue(int numThreads)
Create a new workqueue with the given number of worker threads.

WorkQueue

public WorkQueue(java.lang.String name,
                 int numThreads)
Create a new workqueue with the given number of worker threads.
Method Detail

createObjectPoolObject

public ObjectPoolObject createObjectPoolObject()
Description copied from class: SimpleObjectPool
To be implemented by sub-classes. This is a factory method for creating objects that go in this pool.
Overrides:
createObjectPoolObject in class SimpleObjectPool
Following copied from class: com.protomatter.pool.SimpleObjectPool
Throws:
java.lang.Exception - If there is a problem creating the next object for the pool -- this is implementation specific.

getNumThreads

public int getNumThreads()
Get the number of worker threads associated with this WorkQueue.

getNumWorkers

public int getNumWorkers()
Get the number of threads that are currently performing work.

getQueueLength

public int getQueueLength()
Get the length of the queue (number of work elements yet to be processed).

addWork

public final void addWork(java.lang.Runnable r)
Add a runnable to the list of things to do.

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.7 http://protomatter.sourceforge.net/1.1.7