All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaGroups.Queue

java.lang.Object
   |
   +----JavaGroups.Queue

public class Queue
extends Object
Elements are added at the tail and removed from the head. Class is thread-safe in that 1 producer and 1 consumer may add/remove elements concurrently. The class is not explicitely designed for multiple producers or consumers. Implemented as a linked list, so that removal of an element at the head does not cause a right-shift of the remaining elements (as in a Vector-based implementation).


Constructor Index

 o Queue()

Method Index

 o Add(Object)
 o AddAtHead(Object)
 o Close(boolean)
Marks the queues as closed.
 o GetContents()
 o main(String[])
 o Peek()
 o Peek(long)
Doesn't remove element
 o Remove()
Removes 1 element from head or blocks until next element has been added
 o Remove(long)
 o RemoveElement(Object)
 o Reset()
 o Size()
 o toString()

Constructors

 o Queue
 public Queue()

Methods

 o Add
 public void Add(Object obj) throws QueueClosed
 o AddAtHead
 public void AddAtHead(Object obj) throws QueueClosed
 o Remove
 public Object Remove() throws QueueClosed
Removes 1 element from head or blocks until next element has been added

 o Remove
 public Object Remove(long timeout) throws QueueClosed, Timeout
 o RemoveElement
 public void RemoveElement(Object obj) throws QueueClosed
 o Peek
 public Object Peek() throws QueueClosed
 o Peek
 public Object Peek(long timeout) throws QueueClosed, Timeout
Doesn't remove element

 o Close
 public void Close(boolean flush_entries)
Marks the queues as closed. When an Add or Remove operation is attempted on a closed queue, an exception is thrown.

Parameters:
flush_entries - When true, a end-of-entries marker is added to the end of the queue. Entries may be added and removed, but when the end-of-entries marker is encountered, the queue is marked as closed. This allows to flush pending messages before closing the queue.
 o Reset
 public void Reset()
 o Size
 public int Size()
 o toString
 public String toString()
Overrides:
toString in class Object
 o GetContents
 public Vector GetContents()
 o main
 public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index