Class RedisBlockingQueue
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<Runnable>
-
- org.nuxeo.ecm.core.work.NuxeoBlockingQueue
-
- org.nuxeo.ecm.core.redis.contribs.RedisBlockingQueue
-
- All Implemented Interfaces:
Iterable<Runnable>
,Collection<Runnable>
,BlockingQueue<Runnable>
,Queue<Runnable>
public class RedisBlockingQueue extends NuxeoBlockingQueue
Redis-basedBlockingQueue
.It has unlimited capacity, so never blocks on
NuxeoBlockingQueue.put(java.lang.Runnable)
andNuxeoBlockingQueue.offer(java.lang.Runnable)
always returnstrue
.- Since:
- 5.8
-
-
Field Summary
Fields Modifier and Type Field Description protected Lock
lock
protected Condition
notEmpty
protected RedisWorkQueuing
queuing
-
Fields inherited from class org.nuxeo.ecm.core.work.NuxeoBlockingQueue
activation, activationLock, active, queueId
-
-
Constructor Summary
Constructors Constructor Description RedisBlockingQueue(String queueId, RedisWorkQueuing queuing)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static boolean
delayExpired(AtomicLong atomic)
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()
-
Methods inherited from class org.nuxeo.ecm.core.work.NuxeoBlockingQueue
awaitActivation, contains, drainTo, drainTo, iterator, offer, offer, peek, poll, put, remainingCapacity, setActive, size, timeUntil
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.BlockingQueue
add, remove
-
Methods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
-
-
-
Field Detail
-
queuing
protected final RedisWorkQueuing queuing
-
lock
protected final Lock lock
-
notEmpty
protected final Condition notEmpty
-
-
Constructor Detail
-
RedisBlockingQueue
public RedisBlockingQueue(String queueId, RedisWorkQueuing queuing)
-
-
Method Detail
-
metrics
protected WorkQueueMetrics metrics()
- Specified by:
metrics
in classNuxeoBlockingQueue
-
getQueueSize
public int getQueueSize()
Description copied from class:NuxeoBlockingQueue
Gets the size of the queue.- Specified by:
getQueueSize
in classNuxeoBlockingQueue
-
take
public Runnable take() throws InterruptedException
- Throws:
InterruptedException
-
poll
public Runnable poll(long timeout, TimeUnit unit) throws InterruptedException
- Throws:
InterruptedException
-
putElement
public void putElement(Runnable r)
Description copied from class:NuxeoBlockingQueue
Adds an element into this queue, waiting if necessary for space to become available.- Specified by:
putElement
in classNuxeoBlockingQueue
-
pollElement
public Runnable pollElement()
Description copied from class:NuxeoBlockingQueue
Retrieves and removes an element from the queue, or returns null if the queue is empty.- Specified by:
pollElement
in classNuxeoBlockingQueue
-
delayExpired
protected static boolean delayExpired(AtomicLong atomic)
-
-