edu.sdsc.inca.util
Class WorkQueue

java.lang.Object
  extended byedu.sdsc.inca.util.WorkQueue

public class WorkQueue
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(java.lang.Object o)
          Add a task to the workQueue.
 java.lang.Object 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

addWork

public void addWork(java.lang.Object o)
Add a task to the workQueue.

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

getWork

public java.lang.Object 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.