public final class MTQueue extends Object implements Queue
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 and Description |
|---|
MTQueue(Object mutex,
DNotesMonitor theMonitor)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
dequeue()
Removes the first object from the queue, blocking until one is available.
|
Object |
dequeue(long timeout)
Removes the first object from the queue, blocking only up to the given
timeout time.
|
Object |
dequeueNoWait()
Removes the first object from the queue without blocking.
|
void |
enqueue(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.
|
public MTQueue(Object mutex, DNotesMonitor theMonitor)
mutex - a mutex for syncronizationtheMonitor - the monitorpublic int size()
size in interface QueueQueue.size()public boolean isEmpty()
isEmpty in interface Queuetrue if the queue is empty, else falseQueue.isEmpty()public void enqueue(Object object)
public Object dequeue()
null and could block forever.public Object dequeue(long timeout)
timeout - maximum time to wait for an object from the queuepublic Object dequeueNoWait()
null.Copyright © 2005–2020. All rights reserved.