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).
-
Queue()
-
-
Add(Object)
-
-
AddAtHead(Object)
-
-
Close(boolean)
- Marks the queues as closed.
-
GetContents()
-
-
main(String[])
-
-
Peek()
-
-
Peek(long)
- Doesn't remove element
-
Remove()
- Removes 1 element from head or blocks until next element has been added
-
Remove(long)
-
-
RemoveElement(Object)
-
-
Reset()
-
-
Size()
-
-
toString()
-
Queue
public Queue()
Add
public void Add(Object obj) throws QueueClosed
AddAtHead
public void AddAtHead(Object obj) throws QueueClosed
Remove
public Object Remove() throws QueueClosed
- Removes 1 element from head or blocks until next element has been added
Remove
public Object Remove(long timeout) throws QueueClosed, Timeout
RemoveElement
public void RemoveElement(Object obj) throws QueueClosed
Peek
public Object Peek() throws QueueClosed
Peek
public Object Peek(long timeout) throws QueueClosed, Timeout
- Doesn't remove element
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.
Reset
public void Reset()
Size
public int Size()
toString
public String toString()
- Overrides:
- toString in class Object
GetContents
public Vector GetContents()
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index