public class RedissonBoundedBlockingQueue<V> extends RedissonQueue<V> implements RBoundedBlockingQueue<V>
Distributed and concurrent implementation of bounded BlockingQueue.
codec, name| Modifier | Constructor and Description |
|---|---|
protected |
RedissonBoundedBlockingQueue(Codec codec,
CommandExecutor commandExecutor,
String name,
RedissonClient redisson) |
protected |
RedissonBoundedBlockingQueue(CommandExecutor commandExecutor,
String name,
RedissonClient redisson) |
| Modifier and Type | Method and Description |
|---|---|
RFuture<Boolean> |
addAllAsync(Collection<? extends V> c)
Adds all elements contained in the specified collection
|
RFuture<Boolean> |
addAsync(V e)
Adds element into this collection.
|
void |
clear() |
boolean |
clearExpire()
Clear an expire timeout or expire date for object.
|
RFuture<Boolean> |
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.
|
protected RFuture<Boolean> |
clearExpireAsync(String... keys) |
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
int |
drainTo(Collection<? super V> c) |
int |
drainTo(Collection<? super V> c,
int maxElements) |
RFuture<Integer> |
drainToAsync(Collection<? super V> c)
Removes all available elements from this queue and adds them
to the given collection in async mode.
|
RFuture<Integer> |
drainToAsync(Collection<? super V> c,
int maxElements)
Removes at most the given number of available elements from
this queue and adds them to the given collection in async mode.
|
boolean |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in async mode.
|
protected RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit,
String... keys) |
boolean |
expireAt(Date timestamp)
Set an expire date for object.
|
boolean |
expireAt(long timestamp)
Set an expire date for object.
|
RFuture<Boolean> |
expireAtAsync(Date timestamp)
Set an expire date for object in async mode.
|
RFuture<Boolean> |
expireAtAsync(long timestamp)
Set an expire date for object in async mode.
|
protected RFuture<Boolean> |
expireAtAsync(long timestamp,
String... keys) |
boolean |
offer(V e,
long timeout,
TimeUnit unit) |
RFuture<Boolean> |
offerAsync(V e)
Inserts the specified element into this queue.
|
RFuture<Boolean> |
offerAsync(V e,
long timeout,
TimeUnit unit)
Inserts the specified element into this queue, waiting up to the
specified wait time if necessary for space to become available.
|
V |
poll(long timeout,
TimeUnit unit) |
RFuture<V> |
pollAsync()
Retrieves and removes the head of this queue in async mode.
|
RFuture<V> |
pollAsync(long timeout,
TimeUnit unit)
Retrieves and removes the head of this queue in async mode, waiting up to the
specified wait time if necessary for an element to become available.
|
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.
|
RFuture<V> |
pollFromAnyAsync(long timeout,
TimeUnit unit,
String... queueNames)
Retrieves and removes first available head element of any queue in async mode,
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 of
queueName,
waiting up to the specified wait time if necessary for an element to become available. |
RFuture<V> |
pollLastAndOfferFirstToAsync(String queueName,
long timeout,
TimeUnit unit)
Retrieves and removes last available tail element of this queue and adds it at the head of
queueName,
waiting up to the specified wait time if necessary for an element to become available. |
void |
put(V e) |
RFuture<Void> |
putAsync(V e)
Inserts the specified element into this queue in async mode, waiting if necessary
for space to become available.
|
int |
remainingCapacity() |
long |
remainTimeToLive()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Boolean> |
removeAllAsync(Collection<?> c)
Removes all of this collection's elements that are also contained in the
specified collection.
|
RFuture<Boolean> |
removeAsync(Object o)
Removes a single instance of the specified element from this
collection, if it is present.
|
RFuture<Long> |
sizeInMemoryAsync()
Returns bytes amount used by object in Redis memory.
|
int |
subscribeOnElements(Consumer<V> consumer)
Subscribes on elements appeared in this queue.
|
V |
take() |
RFuture<V> |
takeAsync()
Retrieves and removes the head of this queue in async mode, waiting if necessary
until an element becomes available.
|
V |
takeLastAndOfferFirstTo(String queueName)
Retrieves and removes last available tail element of any queue and adds it at the head of
queueName,
waiting if necessary for an element to become available
in any of defined queues including queue itself. |
RFuture<V> |
takeLastAndOfferFirstToAsync(String queueName)
Retrieves and removes last available tail element of any queue and adds it at the head of
queueName,
waiting if necessary for an element to become available
in any of defined queues including queue itself. |
boolean |
trySetCapacity(int capacity)
Sets queue capacity only if it is not set before.
|
RFuture<Boolean> |
trySetCapacityAsync(int capacity)
Sets queue capacity only if it is not set before.
|
void |
unsubscribe(int listenerId)
Un-subscribes defined listener.
|
element, getFirst, offer, peek, peekAsync, poll, poll, pollAsync, pollLastAndOfferFirstTo, pollLastAndOfferFirstToAsync, remove, removeFirstadd, add, addAfter, addAfterAsync, addAll, addAll, addAllAsync, addAsync, addAsync, addBefore, addBeforeAsync, addListener, addListenerAsync, contains, containsAll, containsAllAsync, containsAsync, equals, fastRemove, fastRemoveAsync, fastSet, fastSetAsync, get, get, getAsync, getAsync, hashCode, indexOf, indexOfAsync, indexOfAsync, isEmpty, iterator, lastIndexOf, lastIndexOfAsync, lastIndexOfAsync, listIterator, listIterator, mapReduce, range, range, rangeAsync, rangeAsync, readAll, readAllAsync, readSort, readSort, readSort, readSort, readSort, readSort, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, remove, remove, remove, removeAll, removeAsync, removeAsync, removeIf, removeListener, removeListenerAsync, retainAll, retainAllAsync, set, setAsync, size, sizeAsync, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, subList, toArray, toArray, toString, trim, trimAsyncaddListener, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsyncclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, contains, offer, removeaddListener, poll, pollLastAndOfferFirstTo, readAlladdAll, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArrayclearExpire, expire, expireAt, expireAt, remainTimeToLivecopy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkaddListenerAsync, peekAsync, pollAsync, pollLastAndOfferFirstToAsync, readAllAsynccontainsAllAsync, containsAsync, retainAllAsync, sizeAsyncexpireAtAsync, remainTimeToLiveAsynccopyAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsyncreplaceAll, sort, spliteratorprotected RedissonBoundedBlockingQueue(CommandExecutor commandExecutor, String name, RedissonClient redisson)
protected RedissonBoundedBlockingQueue(Codec codec, CommandExecutor commandExecutor, String name, RedissonClient redisson)
public RFuture<Boolean> addAsync(V e)
RCollectionAsyncaddAsync in interface RCollectionAsync<V>addAsync in class RedissonList<V>e - - element to addtrue if an element was added
and false if it is already presentpublic RFuture<Void> putAsync(V e)
RBlockingQueueAsyncputAsync in interface RBlockingQueueAsync<V>e - the element to addpublic void put(V e) throws InterruptedException
put in interface BlockingQueue<V>InterruptedExceptionpublic RFuture<Boolean> offerAsync(V e)
RQueueAsyncofferAsync in interface RQueueAsync<V>offerAsync in class RedissonQueue<V>e - the element to addtrue if successful, or falsepublic boolean offer(V e, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<V>InterruptedExceptionpublic RFuture<Boolean> offerAsync(V e, long timeout, TimeUnit unit)
RBoundedBlockingQueueAsyncofferAsync in interface RBoundedBlockingQueueAsync<V>e - the element to addtimeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parametertrue if successful, or false if
the specified waiting time elapses before space is availablepublic RFuture<V> takeAsync()
RBlockingQueueAsynctakeAsync in interface RBlockingQueueAsync<V>public RFuture<Boolean> removeAsync(Object o)
RCollectionAsyncremoveAsync in interface RCollectionAsync<V>removeAsync in class RedissonList<V>o - element to be removed from this collection, if presenttrue if an element was removed as a result of this callpublic RFuture<Boolean> removeAllAsync(Collection<?> c)
RCollectionAsyncremoveAllAsync in interface RCollectionAsync<V>removeAllAsync in class RedissonList<V>c - collection containing elements to be removed from this collectiontrue if this collection changed as a result of the
callpublic RFuture<V> pollAsync()
RQueueAsyncpollAsync in interface RQueueAsync<V>pollAsync in class RedissonQueue<V>nullpublic V take() throws InterruptedException
take in interface BlockingQueue<V>InterruptedExceptionpublic RFuture<V> pollAsync(long timeout, TimeUnit unit)
RBlockingQueueAsyncpollAsync in interface RBlockingQueueAsync<V>timeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameternull if the
specified waiting time elapses before an element is availablepublic V poll(long timeout, TimeUnit unit) throws InterruptedException
poll in interface BlockingQueue<V>InterruptedExceptionpublic V pollFromAny(long timeout, TimeUnit unit, String... queueNames) throws InterruptedException
RBlockingQueuepollFromAny in interface RBlockingQueue<V>timeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameterqueueNames - - queue names. Queue name itself is always includednull if the
specified waiting time elapses before an element is availableInterruptedException - if interrupted while waitingpublic RFuture<V> pollFromAnyAsync(long timeout, TimeUnit unit, String... queueNames)
RBlockingQueueAsyncpollFromAnyAsync in interface RBlockingQueueAsync<V>timeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameterqueueNames - - queue names. Queue name itself is always includednull if the
specified waiting time elapses before an element is availablepublic V takeLastAndOfferFirstTo(String queueName) throws InterruptedException
RBlockingQueuequeueName,
waiting if necessary for an element to become available
in any of defined queues including queue itself.takeLastAndOfferFirstTo in interface RBlockingQueue<V>queueName - - names of destination queuenull if the
specified waiting time elapses before an element is availableInterruptedException - if interrupted while waitingpublic int subscribeOnElements(Consumer<V> consumer)
RBlockingQueueRBlockingQueueAsync.takeAsync() method to get a new element.subscribeOnElements in interface RBlockingQueue<V>consumer - - queue elements listenerpublic void unsubscribe(int listenerId)
RBlockingQueueunsubscribe in interface RBlockingQueue<V>listenerId - - id of listenerpublic RFuture<V> takeLastAndOfferFirstToAsync(String queueName)
RBlockingQueueAsyncqueueName,
waiting if necessary for an element to become available
in any of defined queues including queue itself.takeLastAndOfferFirstToAsync in interface RBlockingQueueAsync<V>queueName - - names of destination queuenull if the
specified waiting time elapses before an element is availablepublic RFuture<V> pollLastAndOfferFirstToAsync(String queueName, long timeout, TimeUnit unit)
RBlockingQueueAsyncqueueName,
waiting up to the specified wait time if necessary for an element to become available.pollLastAndOfferFirstToAsync in interface RBlockingQueueAsync<V>queueName - - names of destination queuetimeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameternull if the
specified waiting time elapses before an element is availablepublic V pollLastAndOfferFirstTo(String queueName, long timeout, TimeUnit unit) throws InterruptedException
RBlockingQueuequeueName,
waiting up to the specified wait time if necessary for an element to become available.pollLastAndOfferFirstTo in interface RBlockingQueue<V>queueName - - names of destination queuetimeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameternull if the
specified waiting time elapses before an element is availableInterruptedException - if interrupted while waitingpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<V>public int drainTo(Collection<? super V> c)
drainTo in interface BlockingQueue<V>public RFuture<Integer> drainToAsync(Collection<? super V> c)
RBlockingQueueAsyncc may result in elements being in neither,
either or both collections when the associated exception is
thrown. Attempts to drain a queue to itself result in
IllegalArgumentException. Further, the behavior of
this operation is undefined if the specified collection is
modified while the operation is in progress.drainToAsync in interface RBlockingQueueAsync<V>c - the collection to transfer elements intopublic int drainTo(Collection<? super V> c, int maxElements)
drainTo in interface BlockingQueue<V>public RFuture<Integer> drainToAsync(Collection<? super V> c, int maxElements)
RBlockingQueueAsyncc may result in elements being in neither,
either or both collections when the associated exception is
thrown. Attempts to drain a queue to itself result in
IllegalArgumentException. Further, the behavior of
this operation is undefined if the specified collection is
modified while the operation is in progress.drainToAsync in interface RBlockingQueueAsync<V>c - the collection to transfer elements intomaxElements - the maximum number of elements to transferpublic RFuture<Boolean> trySetCapacityAsync(int capacity)
RBoundedBlockingQueueAsynctrySetCapacityAsync in interface RBoundedBlockingQueueAsync<V>capacity - - queue capacitytrue if capacity set successfully
false if capacity already setpublic boolean trySetCapacity(int capacity)
RBoundedBlockingQueuetrySetCapacity in interface RBoundedBlockingQueue<V>capacity - - queue capacitytrue if capacity set successfully
false if capacity already setpublic void clear()
clear in interface Collection<V>clear in interface List<V>clear in class RedissonList<V>public RFuture<Boolean> deleteAsync()
RObjectAsyncdeleteAsync in interface RObjectAsyncdeleteAsync in class RedissonObjecttrue if object was deleted false if notpublic RFuture<Long> sizeInMemoryAsync()
RObjectAsyncsizeInMemoryAsync in interface RObjectAsyncsizeInMemoryAsync in class RedissonObjectpublic RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
RExpirableAsyncexpireAsync in interface RExpirableAsynctimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsyncexpireAtAsync in interface RExpirableAsynctimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsyncclearExpireAsync in interface RExpirableAsynctrue if the timeout was cleared and false if notpublic RFuture<Boolean> addAllAsync(Collection<? extends V> c)
RCollectionAsyncaddAllAsync in interface RCollectionAsync<V>addAllAsync in class RedissonList<V>c - - collection of elements to addtrue if at least one element was added
and false if all elements are already presentpublic boolean expire(long timeToLive,
TimeUnit timeUnit)
RExpirableexpire in interface RExpirabletimeToLive - - timeout before object will be deletedtimeUnit - - timeout time unittrue if the timeout was set and false if notpublic boolean expireAt(long timestamp)
RExpirableexpireAt in interface RExpirabletimestamp - - expire date in milliseconds (Unix timestamp)true if the timeout was set and false if notpublic boolean expireAt(Date timestamp)
RExpirableexpireAt in interface RExpirabletimestamp - - expire datetrue if the timeout was set and false if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsyncexpireAtAsync in interface RExpirableAsynctimestamp - - expire datetrue if the timeout was set and false if notpublic boolean clearExpire()
RExpirableclearExpire in interface RExpirabletrue if timeout was removed
false if object does not exist or does not have an associated timeoutpublic long remainTimeToLive()
RExpirableremainTimeToLive in interface RExpirablepublic RFuture<Long> remainTimeToLiveAsync()
RExpirableAsyncremainTimeToLiveAsync in interface RExpirableAsyncprotected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
Copyright © 2014–2020 Redisson. All rights reserved.