|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.bea.domingo.queue.MTQueue
public final class MTQueue
A multithreaded blocking queue which is very useful for implementing producer-consumer style threading patterns.
Multiple blocking threads can wait for items being added to the queue while other threads add to the queue.
Non blocking and timeout based modes of access are possible as well.
Constructor Summary | |
---|---|
MTQueue(java.lang.Object mutex,
DNotesMonitor theMonitor)
Constructor. |
Method Summary | |
---|---|
java.lang.Object |
dequeue()
Removes the first object from the queue, blocking until one is available. |
java.lang.Object |
dequeue(long timeout)
Removes the first object from the queue, blocking only up to the given timeout time. |
java.lang.Object |
dequeueNoWait()
Removes the first object from the queue without blocking. |
void |
enqueue(java.lang.Object object)
Adds a new object to the end of the queue. |
boolean |
isEmpty()
Checks is the queue is empty or not. |
int |
size()
Returns the number of objects in the queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MTQueue(java.lang.Object mutex, DNotesMonitor theMonitor)
mutex
- a mutex for syncronizationtheMonitor
- the monitorMethod Detail |
---|
public int size()
size
in interface Queue
Queue.size()
public boolean isEmpty()
isEmpty
in interface Queue
true
if the queue is empty, else false
Queue.isEmpty()
public void enqueue(java.lang.Object object)
enqueue
in interface Queue
object
- the object to add to the queuepublic java.lang.Object dequeue()
null
and could block forever.
dequeue
in interface Queue
public java.lang.Object dequeue(long timeout)
timeout
- maximum time to wait for an object from the queue
public java.lang.Object dequeueNoWait()
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |