Package org.redisson.api
Interface RBlockingQueue<V>
-
- Type Parameters:
V
- the type of elements held in this collection
- All Superinterfaces:
BlockingQueue<V>
,Collection<V>
,Iterable<V>
,Queue<V>
,RBlockingQueueAsync<V>
,RCollectionAsync<V>
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
,RQueue<V>
,RQueueAsync<V>
- All Known Subinterfaces:
RBlockingDeque<V>
,RBoundedBlockingQueue<V>
,RPriorityBlockingDeque<V>
,RPriorityBlockingQueue<V>
,RTransferQueue<V>
- All Known Implementing Classes:
RedissonBlockingDeque
,RedissonBlockingQueue
,RedissonBoundedBlockingQueue
,RedissonPriorityBlockingDeque
,RedissonPriorityBlockingQueue
,RedissonTransferQueue
public interface RBlockingQueue<V> extends BlockingQueue<V>, RQueue<V>, RBlockingQueueAsync<V>
Distributed implementation ofBlockingQueue
- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description V
pollFromAny(long timeout, TimeUnit unit, String... queueNames)
Retrieves and removes first available head element of any queue, waiting up to the specified wait time if necessary for an element to become available in any of defined queues including queue itself.V
pollLastAndOfferFirstTo(String queueName, long timeout, TimeUnit unit)
Retrieves and removes last available tail element of this queue and adds it at the head ofqueueName
, waiting up to the specified wait time if necessary for an element to become available.int
subscribeOnElements(Consumer<V> consumer)
Subscribes on elements appeared in this queue.V
takeLastAndOfferFirstTo(String queueName)
Retrieves and removes last available tail element of any queue and adds it at the head ofqueueName
, waiting if necessary for an element to become available in any of defined queues including queue itself.void
unsubscribe(int listenerId)
Un-subscribes defined listener.-
Methods inherited from interface java.util.concurrent.BlockingQueue
add, contains, drainTo, drainTo, offer, offer, poll, put, remainingCapacity, remove, take
-
Methods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
-
Methods inherited from interface org.redisson.api.RBlockingQueueAsync
drainToAsync, drainToAsync, pollAsync, pollFromAnyAsync, pollLastAndOfferFirstToAsync, putAsync, takeAsync, takeLastAndOfferFirstToAsync
-
Methods inherited from interface org.redisson.api.RCollectionAsync
addAllAsync, addAsync, containsAllAsync, containsAsync, removeAllAsync, removeAsync, retainAllAsync, sizeAsync
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Methods inherited from interface org.redisson.api.RQueue
addListener, poll, pollLastAndOfferFirstTo, readAll
-
Methods inherited from interface org.redisson.api.RQueueAsync
addListenerAsync, offerAsync, peekAsync, pollAsync, pollAsync, pollLastAndOfferFirstToAsync, readAllAsync
-
-
-
-
Method Detail
-
pollFromAny
V pollFromAny(long timeout, TimeUnit unit, String... queueNames) throws InterruptedException
Retrieves and removes first available head element of any queue, waiting up to the specified wait time if necessary for an element to become available in any of defined queues including queue itself.- Parameters:
queueNames
- - queue names. Queue name itself is always includedtimeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the head of this queue, or
null
if the specified waiting time elapses before an element is available - Throws:
InterruptedException
- if interrupted while waiting
-
pollLastAndOfferFirstTo
V pollLastAndOfferFirstTo(String queueName, long timeout, TimeUnit unit) throws InterruptedException
Retrieves and removes last available tail element of this queue and adds it at the head ofqueueName
, waiting up to the specified wait time if necessary for an element to become available.- Parameters:
queueName
- - names of destination queuetimeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the tail of this queue, or
null
if the specified waiting time elapses before an element is available - Throws:
InterruptedException
- if interrupted while waiting
-
takeLastAndOfferFirstTo
V takeLastAndOfferFirstTo(String queueName) throws InterruptedException
Retrieves and removes last available tail element of any queue and adds it at the head ofqueueName
, waiting if necessary for an element to become available in any of defined queues including queue itself.- Parameters:
queueName
- - names of destination queue- Returns:
- the tail of this queue, or
null
if the specified waiting time elapses before an element is available - Throws:
InterruptedException
- if interrupted while waiting
-
subscribeOnElements
int subscribeOnElements(Consumer<V> consumer)
Subscribes on elements appeared in this queue. Continuously invokesRBlockingQueueAsync.takeAsync()
method to get a new element.- Parameters:
consumer
- - queue elements listener- Returns:
- listenerId - id of listener
-
unsubscribe
void unsubscribe(int listenerId)
Un-subscribes defined listener.- Parameters:
listenerId
- - id of listener
-
-