|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tivoli.twg.libs.ObjectQueue
ObjectQueue is a generic class for defining a FIFO queue of Object references. It is thread-safe, allowing a single reader to dequeue events (without polling) while multiple other threads enqueue Objects.
Constructor Summary | |
---|---|
ObjectQueue()
Constructor for ObjectQueue. |
Method Summary | |
---|---|
java.lang.Object |
dequeue()
Dequeue next Object in queue. |
java.lang.Object |
dequeue(int timeout)
Dequeue next Object in queue. |
void |
enqueue(java.lang.Object obj)
Enqueue an object reference. |
void |
enqueueHead(java.lang.Object obj)
Enqueue an object reference at head of queue (LIFO). |
int |
getQueueLength()
Return current number of elements in the queue |
java.lang.Object |
peek()
Peek next Object on queue. |
boolean |
remove(java.lang.Object obj)
Remove an object from the queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ObjectQueue()
Method Detail |
public void enqueue(java.lang.Object obj)
obj
- - an instance of an Objectpublic void enqueueHead(java.lang.Object obj)
obj
- - an instance of an Objectpublic java.lang.Object dequeue() throws java.lang.InterruptedException
java.lang.InterruptedException
- if another thread has interrupted this thread.public java.lang.Object dequeue(int timeout) throws java.lang.InterruptedException
timeout
- - time, in milliseconds, to wait if no Objects in queue
(<= 0 means no timeout (indefinite wait))
java.lang.InterruptedException
- if another thread has interrupted this thread.public java.lang.Object peek()
public boolean remove(java.lang.Object obj)
public int getQueueLength()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |