Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.altara.util
Class Queue  view Queue download Queue.java

java.lang.Object
  extended byorg.altara.util.Queue

public class Queue
extends java.lang.Object

Queue is a wrapper around a LinkedList providing a queue-oriented view.


Field Summary
(package private)  boolean isLocked
           
(package private)  java.util.LinkedList list
           
 
Constructor Summary
Queue()
           
 
Method Summary
 java.lang.Object dequeue()
          Retrieve the next object from the queue.
 void enqueue(java.lang.Object obj)
          Enqueue an object.
 void flush()
          Flush the queue.
 void lock()
          Lock the queue.
 java.lang.Object nb_dequeue()
          Retrieve the next object from the queue.
 int size()
          Return this queue's size.
 void unlock()
          Unlock the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

java.util.LinkedList list

isLocked

boolean isLocked
Constructor Detail

Queue

public Queue()
Method Detail

lock

public void lock()
Lock the queue. A locked queue may not be dequeued from - i.e. it will block as if it is empty even when it is full. Locking has no effect on nb_dequeue().


unlock

public void unlock()
Unlock the queue. Reverses the effect of a previous lock().


flush

public void flush()
Flush the queue. Removes all elements from the queue.


enqueue

public void enqueue(java.lang.Object obj)
Enqueue an object. This will place the object into the queue for later in-order dequeueing.


dequeue

public java.lang.Object dequeue()
                         throws java.lang.InterruptedException
Retrieve the next object from the queue. This method will block if the queue is empty.


nb_dequeue

public java.lang.Object nb_dequeue()
Retrieve the next object from the queue. This method will return null if the queue is empty.


size

public int size()
Return this queue's size.