public class MemoryBlockingQueue extends NuxeoBlockingQueue
BlockingQueue.
 
 In addition, this implementation also keeps a set of Work ids in the queue when the queue elements are
 WorkHolders.
| Modifier and Type | Field and Description | 
|---|---|
protected BlockingQueue<Runnable> | 
queue  | 
protected Set<String> | 
runningWorks  | 
protected Set<String> | 
scheduledWorks  | 
protected Map<String,Work> | 
works  | 
activation, activationLock, active, queueId, queuing| Constructor and Description | 
|---|
MemoryBlockingQueue(String id,
                   MemoryWorkQueuing queuing,
                   int capacity)
Creates a  
BlockingQueue with a maximum capacity. | 
| Modifier and Type | Method and Description | 
|---|---|
int | 
getQueueSize()
Gets the size of the queue. 
 | 
protected WorkQueueMetrics | 
metrics()  | 
Runnable | 
poll(long timeout,
    TimeUnit unit)  | 
Runnable | 
pollElement()
Retrieves and removes an element from the queue, or returns null if the queue is empty. 
 | 
void | 
putElement(Runnable r)
Adds an element into this queue, waiting if necessary for space to become available. 
 | 
Runnable | 
take()  | 
awaitActivation, contains, drainTo, drainTo, iterator, offer, offer, peek, poll, put, remainingCapacity, setActive, size, timeUntilcontainsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, removeaddAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayprotected final BlockingQueue<Runnable> queue
protected final Set<String> scheduledWorks
protected final Set<String> runningWorks
public MemoryBlockingQueue(String id, MemoryWorkQueuing queuing, int capacity)
BlockingQueue with a maximum capacity.
 
 If the capacity is -1 then this is treated as a regular unbounded LinkedBlockingQueue.
capacity - the capacity, or -1 for unboundedprotected WorkQueueMetrics metrics()
metrics in class NuxeoBlockingQueuepublic int getQueueSize()
NuxeoBlockingQueuegetQueueSize in class NuxeoBlockingQueuepublic void putElement(Runnable r) throws InterruptedException
NuxeoBlockingQueueputElement in class NuxeoBlockingQueueInterruptedExceptionpublic Runnable pollElement()
NuxeoBlockingQueuepollElement in class NuxeoBlockingQueuepublic Runnable take() throws InterruptedException
InterruptedExceptionpublic Runnable poll(long timeout, TimeUnit unit) throws InterruptedException
InterruptedExceptionCopyright © 2019 Nuxeo. All rights reserved.