edu.sdsc.inca.util
Class WorkQueue<T>

java.lang.Object
  extended by edu.sdsc.inca.util.WorkQueue<T>

public class WorkQueue<T>
extends java.lang.Object

Author:
Cathie Olschanowsky Generic work queue class that allows any type of object to be added and removed. This class is thread safe.

Constructor Summary
WorkQueue()
           
 
Method Summary
 void addWork(WorkItem<T> o)
          Add a task to the workQueue.
 void clear()
          Clear the queue of all work
 WorkItem<T> getWork()
          retrieve work from the workQueue.
 boolean isEmpty()
          check to see if there is any work to be done.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkQueue

public WorkQueue()
Method Detail

clear

public void clear()
Clear the queue of all work


addWork

public void addWork(WorkItem<T> o)
Add a task to the workQueue.

Parameters:
o - Object that is the work to be added ( should be a socket )

getWork

public WorkItem<T> getWork()
                    throws java.lang.InterruptedException
retrieve work from the workQueue. blocks if empty.

Returns:
An Object that represents the next unit of work.
Throws:
java.lang.InterruptedException

isEmpty

public boolean isEmpty()
check to see if there is any work to be done.

Returns:
true if there is work available.