Class RedissonBoundedBlockingQueue<V>
- All Implemented Interfaces:
Iterable<V>
,Collection<V>
,BlockingQueue<V>
,Queue<V>
,RBlockingQueue<V>
,RBlockingQueueAsync<V>
,RBoundedBlockingQueue<V>
,RBoundedBlockingQueueAsync<V>
,RCollectionAsync<V>
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
,RQueue<V>
,RQueueAsync<V>
Distributed and concurrent implementation of bounded BlockingQueue
.
- Author:
- Nikita Koksharov
-
Field Summary
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name
-
Constructor Summary
ModifierConstructorDescriptionprotected
RedissonBoundedBlockingQueue
(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson) protected
RedissonBoundedBlockingQueue
(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson) -
Method Summary
Modifier and TypeMethodDescriptionaddAllAsync
(Collection<? extends V> c) Adds all elements contained in the specified collectionAdds element into this collection.void
clear()
boolean
Clear an expire timeout or expire date for object.Clear an expire timeout or expire date for object in async mode.clearExpireAsync
(String... keys) Delete object in async modeint
drainTo
(Collection<? super V> c) int
drainTo
(Collection<? super V> c, int maxElements) drainToAsync
(Collection<? super V> c) Removes all available elements from this queue and adds them to the given collection in async mode.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
UseRExpirable.expire(Duration)
insteadboolean
Sets a timeout for this object.boolean
Sets an expiration date for this object.expireAsync
(long timeToLive, TimeUnit timeUnit) UseRExpirableAsync.expireAsync(Duration)
insteadexpireAsync
(long timeToLive, TimeUnit timeUnit, String param, String... keys) expireAsync
(Duration duration) Set a timeout for object.expireAsync
(Instant instant) Set an expire date for object.boolean
expireAt
(long timestamp) UseRExpirable.expire(Instant)
insteadboolean
UseRExpirable.expire(Instant)
insteadexpireAtAsync
(long timestamp) UseRExpirableAsync.expireAsync(Instant)
insteadexpireAtAsync
(long timestamp, String param, String... keys) expireAtAsync
(Date timestamp) UseRExpirableAsync.expireAsync(Instant)
insteadboolean
expireIfGreater
(Duration duration) Sets a timeout for this object only if it's greater than timeout set before.boolean
expireIfGreater
(Instant time) Sets an expiration date for this object only if it's greater than expiration date set before.expireIfGreaterAsync
(Duration duration) Sets a timeout for this object only if it's greater than timeout set before.expireIfGreaterAsync
(Instant time) Sets an expiration date for this object only if it's greater than expiration date set before.boolean
expireIfLess
(Duration duration) Sets a timeout for this object only if it's less than timeout set before.boolean
expireIfLess
(Instant time) Sets an expiration date for this object only if it's less than expiration date set before.expireIfLessAsync
(Duration duration) Sets a timeout for this object only if it's less than timeout set before.expireIfLessAsync
(Instant time) Sets an expiration date for this object only if it's less than expiration date set before.boolean
expireIfNotSet
(Duration duration) Sets a timeout for this object only if it hasn't been set before.boolean
expireIfNotSet
(Instant time) Sets an expiration date for this object only if it hasn't been set before.expireIfNotSetAsync
(Duration duration) Sets a timeout for this object only if it hasn't been set before.expireIfNotSetAsync
(Instant time) Sets an expiration date for this object only if it hasn't been set before.boolean
expireIfSet
(Duration duration) Sets a timeout for this object only if it has been already set.boolean
expireIfSet
(Instant time) Sets an expiration date for this object only if it has been already set.expireIfSetAsync
(Duration duration) Sets a timeout for this object only if it has been already set.expireIfSetAsync
(Instant time) Sets an expiration date for this object only if it has been already set.long
Expiration time of Redisson object that has a timeoutExpiration time of Redisson object that has a timeoutboolean
offerAsync
(V e) Inserts the specified element into this queue.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.Retrieves and removes the head of this queue in async mode.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.pollFirstFromAny
(Duration duration, int count, String... queueNames) Retrieves and removes first available head elements 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.pollFirstFromAnyAsync
(Duration duration, int count, String... queueNames) Retrieves and removes first available head elements 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.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.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.pollFromAnyWithName
(Duration timeout, 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.pollFromAnyWithNameAsync
(Duration timeout, 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.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.pollLastAndOfferFirstToAsync
(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.pollLastFromAny
(Duration duration, int count, String... queueNames) Retrieves and removes first available tail elements 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.pollLastFromAnyAsync
(Duration duration, int count, String... queueNames) Retrieves and removes first available tail elements 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.void
Inserts the specified element into this queue in async mode, waiting if necessary for space to become available.int
long
Remaining time to live of Redisson object that has a timeoutRemaining time to live of Redisson object that has a timeoutremoveAllAsync
(Collection<?> c) Removes all of this collection's elements that are also contained in the specified collection.Removes a single instance of the specified element from this collection, if it is present.Returns bytes amount used by object in Redis memory.int
subscribeOnElements
(Consumer<V> consumer) UseRBlockingQueue.subscribeOnElements(Function)
instead.int
subscribeOnElements
(Function<V, CompletionStage<Void>> consumer) Subscribes on elements appeared in this queue.take()
Retrieves and removes the head of this queue in async mode, waiting if necessary until an element becomes available.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.takeLastAndOfferFirstToAsync
(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.boolean
trySetCapacity
(int capacity) Sets queue capacity only if it is not set before.trySetCapacityAsync
(int capacity) Sets queue capacity only if it is not set before.void
unsubscribe
(int listenerId) Un-subscribes defined listener.Methods inherited from class org.redisson.RedissonQueue
element, getFirst, offer, peek, peekAsync, poll, poll, pollAsync, pollLastAndOfferFirstTo, pollLastAndOfferFirstToAsync, remove, removeFirst
Methods inherited from class org.redisson.BaseRedissonList
add, add, addAfter, addAfterAsync, addAll, addAll, addAllAsync, addAsync, addAsync, addBefore, addBeforeAsync, addListener, addListenerAsync, contains, containsAll, containsAllAsync, containsAsync, distributedIterator, distributedIterator, 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, trimAsync
Methods inherited from class org.redisson.RedissonObject
addListener, addListenerAsync, addTrackingListener, addTrackingListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, getServiceManager, getSubscribeService, isExists, isExistsAsync, map, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenerAsync, removeTrackingListener, removeTrackingListenerAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.BlockingQueue
add, contains, offer, remove
Methods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
Methods inherited from interface org.redisson.api.RCollectionAsync
containsAllAsync, containsAsync, retainAllAsync, sizeAsync
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLive
Methods inherited from interface org.redisson.api.RExpirableAsync
expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, 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, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
Methods inherited from interface org.redisson.api.RQueue
addListener, poll, pollLastAndOfferFirstTo, readAll
Methods inherited from interface org.redisson.api.RQueueAsync
addListenerAsync, peekAsync, pollAsync, pollLastAndOfferFirstToAsync, readAllAsync
-
Constructor Details
-
RedissonBoundedBlockingQueue
protected RedissonBoundedBlockingQueue(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson) -
RedissonBoundedBlockingQueue
protected RedissonBoundedBlockingQueue(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
-
-
Method Details
-
addAsync
Description copied from interface:RCollectionAsync
Adds element into this collection.- Specified by:
addAsync
in interfaceRCollectionAsync<V>
- Overrides:
addAsync
in classBaseRedissonList<V>
- Parameters:
e
- - element to add- Returns:
true
if an element was added andfalse
if it is already present
-
putAsync
Description copied from interface:RBlockingQueueAsync
Inserts the specified element into this queue in async mode, waiting if necessary for space to become available.- Specified by:
putAsync
in interfaceRBlockingQueueAsync<V>
- Parameters:
e
- the element to add- Returns:
- void
-
put
- Specified by:
put
in interfaceBlockingQueue<V>
- Throws:
InterruptedException
-
offerAsync
Description copied from interface:RQueueAsync
Inserts the specified element into this queue.- Specified by:
offerAsync
in interfaceRQueueAsync<V>
- Overrides:
offerAsync
in classRedissonQueue<V>
- Parameters:
e
- the element to add- Returns:
true
if successful, orfalse
-
offer
- Specified by:
offer
in interfaceBlockingQueue<V>
- Throws:
InterruptedException
-
offerAsync
Description copied from interface:RBoundedBlockingQueueAsync
Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available.- Specified by:
offerAsync
in interfaceRBoundedBlockingQueueAsync<V>
- Parameters:
e
- the element to addtimeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
true
if successful, orfalse
if the specified waiting time elapses before space is available
-
takeAsync
Description copied from interface:RBlockingQueueAsync
Retrieves and removes the head of this queue in async mode, waiting if necessary until an element becomes available.- Specified by:
takeAsync
in interfaceRBlockingQueueAsync<V>
- Returns:
- the head of this queue
-
removeAsync
Description copied from interface:RCollectionAsync
Removes a single instance of the specified element from this collection, if it is present.- Specified by:
removeAsync
in interfaceRCollectionAsync<V>
- Overrides:
removeAsync
in classBaseRedissonList<V>
- Parameters:
o
- element to be removed from this collection, if present- Returns:
true
if an element was removed as a result of this call
-
removeAllAsync
Description copied from interface:RCollectionAsync
Removes all of this collection's elements that are also contained in the specified collection.- Specified by:
removeAllAsync
in interfaceRCollectionAsync<V>
- Overrides:
removeAllAsync
in classBaseRedissonList<V>
- Parameters:
c
- collection containing elements to be removed from this collection- Returns:
true
if this collection changed as a result of the call
-
pollAsync
Description copied from interface:RQueueAsync
Retrieves and removes the head of this queue in async mode.- Specified by:
pollAsync
in interfaceRQueueAsync<V>
- Overrides:
pollAsync
in classRedissonQueue<V>
- Returns:
- the head of this queue, or
null
-
take
- Specified by:
take
in interfaceBlockingQueue<V>
- Throws:
InterruptedException
-
pollAsync
Description copied from interface:RBlockingQueueAsync
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.- Specified by:
pollAsync
in interfaceRBlockingQueueAsync<V>
- Parameters:
timeout
- 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
-
poll
- Specified by:
poll
in interfaceBlockingQueue<V>
- Throws:
InterruptedException
-
pollFromAny
Description copied from interface:RBlockingQueue
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.- Specified by:
pollFromAny
in interfaceRBlockingQueue<V>
- Parameters:
timeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameterqueueNames
- - queue names. Queue name itself is always included- 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
-
pollFromAnyAsync
Description copied from interface:RBlockingQueueAsync
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.- Specified by:
pollFromAnyAsync
in interfaceRBlockingQueueAsync<V>
- Parameters:
timeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameterqueueNames
- - queue names. Queue name itself is always included- Returns:
- Future object with the head of this queue, or
null
if the specified waiting time elapses before an element is available
-
pollFromAnyWithName
public Entry<String,V> pollFromAnyWithName(Duration timeout, String... queueNames) throws InterruptedException Description copied from interface:RBlockingQueue
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.- Specified by:
pollFromAnyWithName
in interfaceRBlockingQueue<V>
- Parameters:
timeout
- how long to wait before giving up, in units ofunit
queueNames
- queue names. Queue name itself is always included- 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
-
pollFromAnyWithNameAsync
Description copied from interface:RBlockingQueueAsync
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.- Specified by:
pollFromAnyWithNameAsync
in interfaceRBlockingQueueAsync<V>
- Parameters:
timeout
- how long to wait before giving upqueueNames
- - queue names. Queue name itself is always included- Returns:
- Future object with the head of this queue, or
null
if the specified waiting time elapses before an element is available
-
pollFirstFromAny
Description copied from interface:RBlockingQueue
Retrieves and removes first available head elements 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.Requires Redis 7.0.0 and higher.
- Specified by:
pollFirstFromAny
in interfaceRBlockingQueue<V>
- Parameters:
duration
- how long to wait before giving upcount
- elements amountqueueNames
- name of queues- Returns:
- the head elements
-
pollLastFromAny
Description copied from interface:RBlockingQueue
Retrieves and removes first available tail elements 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.Requires Redis 7.0.0 and higher.
- Specified by:
pollLastFromAny
in interfaceRBlockingQueue<V>
- Parameters:
duration
- how long to wait before giving upcount
- elements amountqueueNames
- name of queues- Returns:
- the tail elements
-
pollFirstFromAnyAsync
public RFuture<Map<String,List<V>>> pollFirstFromAnyAsync(Duration duration, int count, String... queueNames) Description copied from interface:RBlockingQueueAsync
Retrieves and removes first available head elements 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.Requires Redis 7.0.0 and higher.
- Specified by:
pollFirstFromAnyAsync
in interfaceRBlockingQueueAsync<V>
- Parameters:
duration
- how long to wait before giving upcount
- elements amountqueueNames
- name of queues- Returns:
- the head elements
-
pollLastFromAnyAsync
public RFuture<Map<String,List<V>>> pollLastFromAnyAsync(Duration duration, int count, String... queueNames) Description copied from interface:RBlockingQueueAsync
Retrieves and removes first available tail elements 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.Requires Redis 7.0.0 and higher.
- Specified by:
pollLastFromAnyAsync
in interfaceRBlockingQueueAsync<V>
- Parameters:
duration
- how long to wait before giving upcount
- elements amountqueueNames
- name of queues- Returns:
- the tail elements
-
takeLastAndOfferFirstTo
Description copied from interface:RBlockingQueue
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.- Specified by:
takeLastAndOfferFirstTo
in interfaceRBlockingQueue<V>
- 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
Description copied from interface:RBlockingQueue
UseRBlockingQueue.subscribeOnElements(Function)
instead.- Specified by:
subscribeOnElements
in interfaceRBlockingQueue<V>
- Parameters:
consumer
- - queue elements listener- Returns:
- listenerId - id of listener
-
subscribeOnElements
Description copied from interface:RBlockingQueue
Subscribes on elements appeared in this queue. Continuously invokesRBlockingQueueAsync.takeAsync()
method to get a new element.NOTE: don't call blocking methods in the elements listener
- Specified by:
subscribeOnElements
in interfaceRBlockingQueue<V>
- Parameters:
consumer
- - queue elements listener- Returns:
- listenerId - id of listener
-
unsubscribe
public void unsubscribe(int listenerId) Description copied from interface:RBlockingQueue
Un-subscribes defined listener.- Specified by:
unsubscribe
in interfaceRBlockingQueue<V>
- Parameters:
listenerId
- - id of listener
-
takeLastAndOfferFirstToAsync
Description copied from interface:RBlockingQueueAsync
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.- Specified by:
takeLastAndOfferFirstToAsync
in interfaceRBlockingQueueAsync<V>
- 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
-
pollLastAndOfferFirstToAsync
Description copied from interface:RBlockingQueueAsync
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.- Specified by:
pollLastAndOfferFirstToAsync
in interfaceRBlockingQueueAsync<V>
- 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
-
pollLastAndOfferFirstTo
public V pollLastAndOfferFirstTo(String queueName, long timeout, TimeUnit unit) throws InterruptedException Description copied from interface:RBlockingQueue
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.- Specified by:
pollLastAndOfferFirstTo
in interfaceRBlockingQueue<V>
- 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
-
remainingCapacity
public int remainingCapacity()- Specified by:
remainingCapacity
in interfaceBlockingQueue<V>
-
drainTo
- Specified by:
drainTo
in interfaceBlockingQueue<V>
-
drainToAsync
Description copied from interface:RBlockingQueueAsync
Removes all available elements from this queue and adds them to the given collection in async mode. This operation may be more efficient than repeatedly polling this queue. A failure encountered while attempting to add elements to collectionc
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 inIllegalArgumentException
. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.- Specified by:
drainToAsync
in interfaceRBlockingQueueAsync<V>
- Parameters:
c
- the collection to transfer elements into- Returns:
- the number of elements transferred
-
drainTo
- Specified by:
drainTo
in interfaceBlockingQueue<V>
-
drainToAsync
Description copied from interface:RBlockingQueueAsync
Removes at most the given number of available elements from this queue and adds them to the given collection in async mode. A failure encountered while attempting to add elements to collectionc
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 inIllegalArgumentException
. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.- Specified by:
drainToAsync
in interfaceRBlockingQueueAsync<V>
- Parameters:
c
- the collection to transfer elements intomaxElements
- the maximum number of elements to transfer- Returns:
- the number of elements transferred
-
trySetCapacityAsync
Description copied from interface:RBoundedBlockingQueueAsync
Sets queue capacity only if it is not set before.- Specified by:
trySetCapacityAsync
in interfaceRBoundedBlockingQueueAsync<V>
- Parameters:
capacity
- - queue capacity- Returns:
true
if capacity set successfullyfalse
if capacity already set
-
trySetCapacity
public boolean trySetCapacity(int capacity) Description copied from interface:RBoundedBlockingQueue
Sets queue capacity only if it is not set before.- Specified by:
trySetCapacity
in interfaceRBoundedBlockingQueue<V>
- Parameters:
capacity
- - queue capacity- Returns:
true
if capacity set successfullyfalse
if capacity already set
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<V>
- Overrides:
clear
in classBaseRedissonList<V>
-
deleteAsync
Description copied from interface:RObjectAsync
Delete object in async mode- Specified by:
deleteAsync
in interfaceRObjectAsync
- Overrides:
deleteAsync
in classRedissonObject
- Returns:
true
if object was deletedfalse
if not
-
sizeInMemoryAsync
Description copied from interface:RObjectAsync
Returns bytes amount used by object in Redis memory.- Specified by:
sizeInMemoryAsync
in interfaceRObjectAsync
- Overrides:
sizeInMemoryAsync
in classRedissonObject
- Returns:
- size in bytes
-
expireAsync
-
expireAtAsync
-
clearExpireAsync
Description copied from interface:RExpirableAsync
Clear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
clearExpireAsync
in interfaceRExpirableAsync
- Returns:
true
if the timeout was cleared andfalse
if not
-
addAllAsync
Description copied from interface:RCollectionAsync
Adds all elements contained in the specified collection- Specified by:
addAllAsync
in interfaceRCollectionAsync<V>
- Overrides:
addAllAsync
in classBaseRedissonList<V>
- Parameters:
c
- - collection of elements to add- Returns:
true
if at least one element was added andfalse
if all elements are already present
-
expire
Description copied from interface:RExpirable
UseRExpirable.expire(Duration)
instead- Specified by:
expire
in interfaceRExpirable
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Duration)
instead- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(long timestamp) Description copied from interface:RExpirable
UseRExpirable.expire(Instant)
instead- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Instant)
instead- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expire
Description copied from interface:RExpirable
Sets an expiration date for this object. When expire date comes the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
instant
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSet
Description copied from interface:RExpirable
Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSet
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSetAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSetAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSet
Description copied from interface:RExpirable
Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSet
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSetAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSetAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreater
Description copied from interface:RExpirable
Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreater
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreaterAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreaterAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLess
Description copied from interface:RExpirable
Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLess
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLessAsync
Description copied from interface:RExpirableAsync
Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLessAsync
in interfaceRExpirableAsync
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
Description copied from interface:RExpirableAsync
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
instant
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expire
Description copied from interface:RExpirable
Sets a timeout for this object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
Description copied from interface:RExpirableAsync
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
Description copied from interface:RExpirable
UseRExpirable.expire(Instant)
instead- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
Description copied from interface:RExpirableAsync
UseRExpirableAsync.expireAsync(Instant)
instead- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSet
Description copied from interface:RExpirable
Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSet
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSetAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSetAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSet
Description copied from interface:RExpirable
Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSet
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSetAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSetAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreater
Description copied from interface:RExpirable
Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreater
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreaterAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreaterAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLess
Description copied from interface:RExpirable
Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLess
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLessAsync
Description copied from interface:RExpirableAsync
Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLessAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
clearExpire
public boolean clearExpire()Description copied from interface:RExpirable
Clear an expire timeout or expire date for object.- Specified by:
clearExpire
in interfaceRExpirable
- Returns:
true
if timeout was removedfalse
if object does not exist or does not have an associated timeout
-
remainTimeToLive
public long remainTimeToLive()Description copied from interface:RExpirable
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLive
in interfaceRExpirable
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
remainTimeToLiveAsync
Description copied from interface:RExpirableAsync
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLiveAsync
in interfaceRExpirableAsync
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
getExpireTime
public long getExpireTime()Description copied from interface:RExpirable
Expiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTime
in interfaceRExpirable
- Returns:
- expiration time
-
getExpireTimeAsync
Description copied from interface:RExpirableAsync
Expiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTimeAsync
in interfaceRExpirableAsync
- Returns:
- expiration time
-
clearExpireAsync
-