public class RedissonBoundedBlockingQueue<V> extends RedissonQueue<V> implements RBoundedBlockingQueue<V>
Distributed and concurrent implementation of bounded BlockingQueue
.
EVAL_BOOLEAN_ARGS2
codec
Modifier | Constructor and Description |
---|---|
protected |
RedissonBoundedBlockingQueue(SemaphorePubSub semaphorePubSub,
Codec codec,
CommandExecutor commandExecutor,
String name,
RedissonClient redisson) |
protected |
RedissonBoundedBlockingQueue(SemaphorePubSub semaphorePubSub,
CommandExecutor commandExecutor,
String name,
RedissonClient redisson) |
Modifier and Type | Method and Description |
---|---|
RFuture<Boolean> |
addAllAsync(Collection<? extends V> c) |
RFuture<Boolean> |
addAsync(V e) |
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.
|
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.
|
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.
|
boolean |
offer(V e,
long timeout,
TimeUnit unit) |
RFuture<Boolean> |
offerAsync(V e) |
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() |
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 own.
|
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 own.
|
V |
pollLastAndOfferFirstTo(String queueName,
long timeout,
TimeUnit unit) |
RFuture<V> |
pollLastAndOfferFirstToAsync(String queueName,
long timeout,
TimeUnit unit) |
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()
Get remaining time to live of object in seconds.
|
RFuture<Boolean> |
removeAllAsync(Collection<?> c)
Removes all of this collection's elements that are also contained in the
specified collection (optional operation).
|
RFuture<Boolean> |
removeAsync(Object o)
Removes a single instance of the specified element from this
collection, if it is present (optional operation).
|
V |
take() |
RFuture<V> |
takeAsync()
Retrieves and removes the head of this queue in async mode, waiting if necessary
until an element becomes available.
|
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.
|
element, getFirst, offer, peek, peekAsync, poll, pollLastAndOfferFirstTo, pollLastAndOfferFirstToAsync, remove, removeFirst, toSeconds
add, add, addAfter, addAfterAsync, addAll, addAll, addAllAsync, addAsync, addBefore, addBeforeAsync, contains, containsAll, containsAllAsync, containsAsync, equals, fastRemove, fastRemoveAsync, fastSet, fastSetAsync, get, getAsync, hashCode, indexOf, indexOfAsync, indexOfAsync, isEmpty, iterator, lastIndexOf, lastIndexOfAsync, lastIndexOfAsync, listIterator, listIterator, mapReduce, readAll, readAllAsync, readSort, readSort, readSort, readSort, readSort, readSort, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, remove, remove, remove, remove, removeAll, removeAsync, removeAsync, retainAll, retainAllAsync, set, setAsync, size, sizeAsync, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, subList, toArray, toArray, toString, trim, trimAsync
await, delete, encode, encodeMapKey, encodeMapValue, get, getCodec, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, newPromise, newSucceededFuture, prefixName, rename, renameAsync, renamenx, renamenxAsync, suffixName, touch, touchAsync
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, contains, offer, remove
pollLastAndOfferFirstTo, readAll
addAll, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray
clearExpire, expire, expireAt, expireAt, remainTimeToLive
delete, getCodec, getName, isExists, migrate, move, rename, renamenx, touch
peekAsync, pollLastAndOfferFirstToAsync, readAllAsync
containsAllAsync, containsAsync, retainAllAsync, sizeAsync
expireAtAsync, remainTimeToLiveAsync
isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, touchAsync
protected RedissonBoundedBlockingQueue(SemaphorePubSub semaphorePubSub, CommandExecutor commandExecutor, String name, RedissonClient redisson)
protected RedissonBoundedBlockingQueue(SemaphorePubSub semaphorePubSub, Codec codec, CommandExecutor commandExecutor, String name, RedissonClient redisson)
public RFuture<Boolean> addAsync(V e)
addAsync
in interface RCollectionAsync<V>
addAsync
in class RedissonList<V>
public RFuture<Void> putAsync(V e)
RBlockingQueueAsync
putAsync
in interface RBlockingQueueAsync<V>
e
- the element to addpublic void put(V e) throws InterruptedException
put
in interface BlockingQueue<V>
InterruptedException
public RFuture<Boolean> offerAsync(V e)
offerAsync
in interface RQueueAsync<V>
offerAsync
in class RedissonQueue<V>
public boolean offer(V e, long timeout, TimeUnit unit) throws InterruptedException
offer
in interface BlockingQueue<V>
InterruptedException
public RFuture<Boolean> offerAsync(V e, long timeout, TimeUnit unit)
RBoundedBlockingQueueAsync
offerAsync
in interface RBoundedBlockingQueueAsync<V>
e
- the element to addtimeout
- how long to wait before giving up, in units of
unit
unit
- 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()
RBlockingQueueAsync
takeAsync
in interface RBlockingQueueAsync<V>
public RFuture<Boolean> removeAsync(Object o)
RCollectionAsync
removeAsync
in interface RCollectionAsync<V>
removeAsync
in class RedissonList<V>
o
- element to be removed from this collection, if presentpublic RFuture<Boolean> removeAllAsync(Collection<?> c)
RCollectionAsync
removeAllAsync
in interface RCollectionAsync<V>
removeAllAsync
in class RedissonList<V>
c
- collection containing elements to be removed from this collectionpublic RFuture<V> pollAsync()
pollAsync
in interface RQueueAsync<V>
pollAsync
in class RedissonQueue<V>
public V take() throws InterruptedException
take
in interface BlockingQueue<V>
InterruptedException
public RFuture<V> pollAsync(long timeout, TimeUnit unit)
RBlockingQueueAsync
pollAsync
in interface RBlockingQueueAsync<V>
timeout
- how long to wait before giving up, in units of
unit
unit
- 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>
InterruptedException
public V pollFromAny(long timeout, TimeUnit unit, String... queueNames) throws InterruptedException
RBlockingQueue
pollFromAny
in interface RBlockingQueue<V>
timeout
- how long to wait before giving up, in units of
unit
unit
- a TimeUnit
determining how to interpret the
timeout
parameterqueueNames
- - names of queuenull
if the
specified waiting time elapses before an element is availableInterruptedException
- if interrupted while waitingpublic RFuture<V> pollFromAnyAsync(long timeout, TimeUnit unit, String... queueNames)
RBlockingQueueAsync
pollFromAnyAsync
in interface RBlockingQueueAsync<V>
timeout
- how long to wait before giving up, in units of
unit
unit
- a TimeUnit
determining how to interpret the
timeout
parameterqueueNames
- - names of queuenull
if the
specified waiting time elapses before an element is availablepublic RFuture<V> pollLastAndOfferFirstToAsync(String queueName, long timeout, TimeUnit unit)
pollLastAndOfferFirstToAsync
in interface RBlockingQueueAsync<V>
public V pollLastAndOfferFirstTo(String queueName, long timeout, TimeUnit unit) throws InterruptedException
pollLastAndOfferFirstTo
in interface RBlockingQueue<V>
InterruptedException
public 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)
RBlockingQueueAsync
c
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)
RBlockingQueueAsync
c
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)
RBoundedBlockingQueueAsync
trySetCapacityAsync
in interface RBoundedBlockingQueueAsync<V>
capacity
- - queue capacitytrue
if capacity set successfully
false
if capacity already setpublic boolean trySetCapacity(int capacity)
RBoundedBlockingQueue
trySetCapacity
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()
RObjectAsync
deleteAsync
in interface RObjectAsync
deleteAsync
in class RedissonObject
true
if object was deleted false
if notpublic RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
RExpirableAsync
expireAsync
in interface RExpirableAsync
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire date in seconds (Unix timestamp)true
if the timeout was set and false
if notpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsync
clearExpireAsync
in interface RExpirableAsync
true
if the timeout was cleared and false
if notpublic RFuture<Boolean> addAllAsync(Collection<? extends V> c)
addAllAsync
in interface RCollectionAsync<V>
addAllAsync
in class RedissonList<V>
public boolean expire(long timeToLive, TimeUnit timeUnit)
RExpirable
expire
in interface RExpirable
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic boolean expireAt(long timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic boolean expireAt(Date timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic boolean clearExpire()
RExpirable
clearExpire
in interface RExpirable
true
if timeout was removed
false
if object does not exist or does not have an associated timeoutpublic long remainTimeToLive()
RExpirable
remainTimeToLive
in interface RExpirable
public RFuture<Long> remainTimeToLiveAsync()
RExpirableAsync
remainTimeToLiveAsync
in interface RExpirableAsync
-1
if object does not exist or time in secondsCopyright © 2014–2017 The Redisson Project. All rights reserved.