Package org.nuxeo.ecm.core.work
Class MemoryBlockingQueue
java.lang.Object
java.util.AbstractCollection<Runnable>
java.util.AbstractQueue<Runnable>
org.nuxeo.ecm.core.work.NuxeoBlockingQueue
org.nuxeo.ecm.core.work.MemoryBlockingQueue
- All Implemented Interfaces:
Iterable<Runnable>,Collection<Runnable>,BlockingQueue<Runnable>,Queue<Runnable>
Memory-based
BlockingQueue.
In addition, this implementation also keeps a set of Work ids in the queue when the queue elements are
WorkHolders.
-
Field Summary
FieldsFields inherited from class org.nuxeo.ecm.core.work.NuxeoBlockingQueue
activation, activationLock, active, queueId, queuing -
Constructor Summary
ConstructorsConstructorDescriptionMemoryBlockingQueue(String id, MemoryWorkQueuing queuing, int capacity) Creates aBlockingQueuewith a maximum capacity. -
Method Summary
Modifier and TypeMethodDescriptionintGets the size of the queue.protected WorkQueueMetricsmetrics()Retrieves and removes an element from the queue, or returns null if the queue is empty.voidAdds an element into this queue, waiting if necessary for space to become available.take()Methods inherited from class org.nuxeo.ecm.core.work.NuxeoBlockingQueue
awaitActivation, contains, drainTo, drainTo, iterator, offer, offer, peek, poll, put, remainingCapacity, setActive, size, timeUntilMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
add, removeMethods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Field Details
-
queue
-
works
-
scheduledWorks
-
runningWorks
-
-
Constructor Details
-
MemoryBlockingQueue
Creates aBlockingQueuewith a maximum capacity.If the capacity is -1 then this is treated as a regular unbounded
LinkedBlockingQueue.- Parameters:
capacity- the capacity, or -1 for unbounded
-
-
Method Details
-
metrics
- Specified by:
metricsin classNuxeoBlockingQueue
-
getQueueSize
public int getQueueSize()Description copied from class:NuxeoBlockingQueueGets the size of the queue.- Specified by:
getQueueSizein classNuxeoBlockingQueue
-
putElement
Description copied from class:NuxeoBlockingQueueAdds an element into this queue, waiting if necessary for space to become available.- Specified by:
putElementin classNuxeoBlockingQueue- Throws:
InterruptedException
-
pollElement
Description copied from class:NuxeoBlockingQueueRetrieves and removes an element from the queue, or returns null if the queue is empty.- Specified by:
pollElementin classNuxeoBlockingQueue
-
take
- Throws:
InterruptedException
-
poll
- Throws:
InterruptedException
-