anon.util
Class ObjectQueue

java.lang.Object
  extended by anon.util.ObjectQueue

public class ObjectQueue
extends java.lang.Object

This is a generic object queue.

Author:
Rolf Wendolsky

Nested Class Summary
private  class ObjectQueue.QueueItem
           
 
Field Summary
private  ObjectQueue.QueueItem m_foot
           
private  ObjectQueue.QueueItem m_head
           
private  int m_size
           
 
Constructor Summary
ObjectQueue()
           
 
Method Summary
 int getSize()
           
 boolean isEmpty()
           
 java.lang.Object poll(int a_msTimeout)
          Pools the queue for an object to become available until timeout is reached.
 java.lang.Object pop()
          Get an object from the queue.
 void push(java.lang.Object a_object)
          Put an object into the queue
 java.lang.Object take()
          Takes the head of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_head

private ObjectQueue.QueueItem m_head

m_foot

private ObjectQueue.QueueItem m_foot

m_size

private int m_size
Constructor Detail

ObjectQueue

public ObjectQueue()
Method Detail

getSize

public int getSize()

push

public void push(java.lang.Object a_object)
Put an object into the queue


pop

public java.lang.Object pop()
Get an object from the queue. If the queue is empty returns null


take

public java.lang.Object take()
                      throws java.lang.InterruptedException
Takes the head of the queue. Waits until an element is in the queue if necessary

Throws:
java.lang.InterruptedException

poll

public java.lang.Object poll(int a_msTimeout)
                      throws java.lang.InterruptedException
Pools the queue for an object to become available until timeout is reached. returns null if timneout was reached

Throws:
java.lang.InterruptedException

isEmpty

public boolean isEmpty()