public class RedissonTransferQueue<V> extends RedissonObject implements RTransferQueue<V>
Modifier and Type | Class and Description |
---|---|
static interface |
RedissonTransferQueue.TransferQueueService |
static interface |
RedissonTransferQueue.TransferQueueServiceAsync |
static class |
RedissonTransferQueue.TransferQueueServiceImpl |
codec, commandExecutor, name
Constructor and Description |
---|
RedissonTransferQueue(Codec codec,
CommandAsyncExecutor commandExecutor,
String name,
RRemoteService remoteService) |
RedissonTransferQueue(CommandAsyncExecutor commandExecutor,
String name,
RRemoteService remoteService) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(V v) |
boolean |
addAll(Collection<? extends V> c) |
RFuture<Boolean> |
addAllAsync(Collection<? extends V> c)
Adds all elements contained in the specified collection
|
RFuture<Boolean> |
addAsync(V v)
Adds element into this collection.
|
void |
clear() |
RFuture<Void> |
clearAsync() |
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) |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
RFuture<Boolean> |
containsAllAsync(Collection<?> c)
Returns
true if this collection contains all of the elements
in the specified collection. |
RFuture<Boolean> |
containsAsync(Object o)
Returns
true if this collection contains encoded state of the specified element. |
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.
|
V |
element() |
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) |
RFuture<V> |
getValueAsync(int index) |
int |
getWaitingConsumerCount() |
boolean |
hasWaitingConsumer() |
boolean |
isEmpty() |
Iterator<V> |
iterator() |
boolean |
offer(V v) |
boolean |
offer(V v,
long timeout,
TimeUnit unit) |
RFuture<Boolean> |
offerAsync(V e)
Inserts the specified element into this queue.
|
V |
peek() |
RFuture<V> |
peekAsync()
Retrieves the head of this queue in async mode.
|
V |
poll() |
List<V> |
poll(int limit)
Retrieves and removes the head elements of this queue.
|
V |
poll(long timeout,
TimeUnit unit) |
RFuture<V> |
pollAsync()
Retrieves and removes the head of this queue in async mode.
|
RFuture<List<V>> |
pollAsync(int limit)
Retrieves and removes the head elements of this queue.
|
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)
Retrieves and removes last available tail element of this queue queue and adds it at the head of
queueName . |
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)
Retrieves and removes last available tail element of this queue queue and adds it at the head of
queueName . |
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 v) |
RFuture<Void> |
putAsync(V value)
Inserts the specified element into this queue in async mode, waiting if necessary
for space to become available.
|
List<V> |
readAll()
Returns all queue elements at once
|
RFuture<List<V>> |
readAllAsync()
Returns all queue elements at once
|
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
|
V |
remove() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
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.
|
boolean |
retainAll(Collection<?> c) |
RFuture<Boolean> |
retainAllAsync(Collection<?> c)
Retains only the elements in this collection that are contained in the
specified collection.
|
int |
size() |
RFuture<Integer> |
sizeAsync()
Returns number of elements in this collection.
|
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. |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
void |
transfer(V v) |
RFuture<Void> |
transferAsync(V v)
Transfers the element to waiting consumer
which invoked
RBlockingQueueAsync.takeAsync() or RBlockingQueueAsync.pollAsync(long, java.util.concurrent.TimeUnit) method
at the moment of transfer. |
boolean |
tryTransfer(V v) |
boolean |
tryTransfer(V v,
long timeout,
TimeUnit unit) |
RFuture<Boolean> |
tryTransferAsync(V v)
Tries to transfer the element to waiting consumer
which invoked
RBlockingQueueAsync.takeAsync() or RBlockingQueueAsync.pollAsync(long, java.util.concurrent.TimeUnit) method
at the moment of transfer. |
RFuture<Boolean> |
tryTransferAsync(V v,
long timeout,
TimeUnit unit)
Transfers the element to waiting consumer
which invoked
RBlockingQueueAsync.takeAsync() or RBlockingQueueAsync.pollAsync(long, java.util.concurrent.TimeUnit) method
at the moment of transfer. |
void |
unsubscribe(int listenerId)
Un-subscribes defined listener.
|
addListener, addListener, addListenerAsync, addListenerAsync, copy, copyAsync, delete, deleteAsync, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getLockByMapKey, getLockByValue, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListener
equals, hashCode, parallelStream, removeIf, spliterator, stream
clearExpire, expire, expireAt, expireAt, remainTimeToLive
copy, delete, dump, getCodec, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
addListenerAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
public RedissonTransferQueue(Codec codec, CommandAsyncExecutor commandExecutor, String name, RRemoteService remoteService)
public RedissonTransferQueue(CommandAsyncExecutor commandExecutor, String name, RRemoteService remoteService)
public boolean tryTransfer(V v)
tryTransfer
in interface TransferQueue<V>
public RFuture<Boolean> tryTransferAsync(V v)
RTransferQueueAsync
RBlockingQueueAsync.takeAsync()
or RBlockingQueueAsync.pollAsync(long, java.util.concurrent.TimeUnit)
method
at the moment of transfer.tryTransferAsync
in interface RTransferQueueAsync<V>
v
- element to transfertrue
if element was transferred, otherwise
false
public void transfer(V v) throws InterruptedException
transfer
in interface TransferQueue<V>
InterruptedException
public RFuture<Void> transferAsync(V v)
RTransferQueueAsync
RBlockingQueueAsync.takeAsync()
or RBlockingQueueAsync.pollAsync(long, java.util.concurrent.TimeUnit)
method
at the moment of transfer.
Waits if necessary for a consumer.transferAsync
in interface RTransferQueueAsync<V>
v
- the element to transferpublic boolean tryTransfer(V v, long timeout, TimeUnit unit) throws InterruptedException
tryTransfer
in interface TransferQueue<V>
InterruptedException
public RFuture<Boolean> tryTransferAsync(V v, long timeout, TimeUnit unit)
RTransferQueueAsync
RBlockingQueueAsync.takeAsync()
or RBlockingQueueAsync.pollAsync(long, java.util.concurrent.TimeUnit)
method
at the moment of transfer.
Waits up to defined timeout
if necessary for a consumer.tryTransferAsync
in interface RTransferQueueAsync<V>
v
- the element to transfertimeout
- the maximum time to waitunit
- the time unittrue
if the element was transferred and false
otherwisepublic boolean hasWaitingConsumer()
hasWaitingConsumer
in interface TransferQueue<V>
public int getWaitingConsumerCount()
getWaitingConsumerCount
in interface TransferQueue<V>
public boolean add(V v)
add
in interface Collection<V>
add
in interface BlockingQueue<V>
add
in interface Queue<V>
public RFuture<Boolean> addAsync(V v)
RCollectionAsync
addAsync
in interface RCollectionAsync<V>
v
- - element to addtrue
if an element was added
and false
if it is already presentpublic boolean offer(V v)
public RFuture<V> pollAsync()
RQueueAsync
pollAsync
in interface RQueueAsync<V>
null
public RFuture<V> peekAsync()
RQueueAsync
peekAsync
in interface RQueueAsync<V>
null
public void put(V v) throws InterruptedException
put
in interface BlockingQueue<V>
InterruptedException
public boolean offer(V v, long timeout, TimeUnit unit) throws InterruptedException
offer
in interface BlockingQueue<V>
InterruptedException
public V take() throws InterruptedException
take
in interface BlockingQueue<V>
InterruptedException
public RFuture<V> takeAsync()
RBlockingQueueAsync
takeAsync
in interface RBlockingQueueAsync<V>
public V poll(long timeout, TimeUnit unit) throws InterruptedException
poll
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 int remainingCapacity()
remainingCapacity
in interface BlockingQueue<V>
public boolean remove(Object o)
remove
in interface Collection<V>
remove
in interface BlockingQueue<V>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<V>
public boolean addAll(Collection<? extends V> c)
addAll
in interface Collection<V>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<V>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<V>
public void clear()
clear
in interface Collection<V>
public int size()
size
in interface Collection<V>
public RFuture<Integer> sizeAsync()
RCollectionAsync
sizeAsync
in interface RCollectionAsync<V>
public boolean isEmpty()
isEmpty
in interface Collection<V>
public boolean contains(Object o)
contains
in interface Collection<V>
contains
in interface BlockingQueue<V>
public Object[] toArray()
toArray
in interface Collection<V>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<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 List<V> readAll()
RTransferQueue
readAll
in interface RQueue<V>
readAll
in interface RTransferQueue<V>
readAll
in interface RTransferQueueAsync<V>
public RFuture<List<V>> readAllAsync()
RQueueAsync
readAllAsync
in interface RQueueAsync<V>
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
- - queue names. Queue name itself is always includednull
if the
specified waiting time elapses before an element is availableInterruptedException
- if interrupted while waitingpublic V pollLastAndOfferFirstTo(String queueName, long timeout, TimeUnit unit) throws InterruptedException
RBlockingQueue
queueName
,
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
unit
unit
- a TimeUnit
determining how to interpret the
timeout
parameternull
if the
specified waiting time elapses before an element is availableInterruptedException
- if interrupted while waitingpublic V takeLastAndOfferFirstTo(String queueName) throws InterruptedException
RBlockingQueue
queueName
,
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)
RBlockingQueue
RBlockingQueueAsync.takeAsync()
method to get a new element.subscribeOnElements
in interface RBlockingQueue<V>
consumer
- - queue elements listenerpublic void unsubscribe(int listenerId)
RBlockingQueue
unsubscribe
in interface RBlockingQueue<V>
listenerId
- - id of listenerpublic V pollLastAndOfferFirstTo(String queueName)
RQueue
queueName
.pollLastAndOfferFirstTo
in interface RQueue<V>
queueName
- - names of destination queuenull
if the
specified waiting time elapses before an element is availablepublic List<V> poll(int limit)
RQueue
limit
param.public 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
- - queue names. Queue name itself is always includednull
if the
specified waiting time elapses before an element is availablepublic RFuture<V> pollLastAndOfferFirstToAsync(String queueName, long timeout, TimeUnit unit)
RBlockingQueueAsync
queueName
,
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
unit
unit
- a TimeUnit
determining how to interpret the
timeout
parameternull
if the
specified waiting time elapses before an element is availablepublic RFuture<V> takeLastAndOfferFirstToAsync(String queueName)
RBlockingQueueAsync
queueName
,
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<Void> putAsync(V value)
RBlockingQueueAsync
putAsync
in interface RBlockingQueueAsync<V>
value
- the element to addpublic RFuture<Boolean> offerAsync(V e)
RQueueAsync
offerAsync
in interface RQueueAsync<V>
e
- the element to addtrue
if successful, or false
public RFuture<V> pollLastAndOfferFirstToAsync(String queueName)
RQueueAsync
queueName
.pollLastAndOfferFirstToAsync
in interface RQueueAsync<V>
queueName
- - names of destination queuenull
if the
specified waiting time elapses before an element is availablepublic RFuture<List<V>> pollAsync(int limit)
RQueueAsync
limit
param.pollAsync
in interface RQueueAsync<V>
public RFuture<Boolean> retainAllAsync(Collection<?> c)
RCollectionAsync
retainAllAsync
in interface RCollectionAsync<V>
c
- collection containing elements to be retained in this collectiontrue
if this collection changed as a result of the callpublic RFuture<Boolean> removeAllAsync(Collection<?> c)
RCollectionAsync
removeAllAsync
in interface RCollectionAsync<V>
c
- collection containing elements to be removed from this collectiontrue
if this collection changed as a result of the
callpublic RFuture<Boolean> containsAsync(Object o)
RCollectionAsync
true
if this collection contains encoded state of the specified element.containsAsync
in interface RCollectionAsync<V>
o
- element whose presence in this collection is to be testedtrue
if this collection contains the specified
element and false
otherwisepublic RFuture<Boolean> containsAllAsync(Collection<?> c)
RCollectionAsync
true
if this collection contains all of the elements
in the specified collection.containsAllAsync
in interface RCollectionAsync<V>
c
- collection to be checked for containment in this collectiontrue
if this collection contains all of the elements
in the specified collectionpublic RFuture<Boolean> removeAsync(Object o)
RCollectionAsync
removeAsync
in interface RCollectionAsync<V>
o
- element to be removed from this collection, if presenttrue
if an element was removed as a result of this callpublic RFuture<Boolean> addAllAsync(Collection<? extends V> c)
RCollectionAsync
addAllAsync
in interface RCollectionAsync<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)
RExpirable
expire
in interface RExpirable
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and 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 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 RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
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 RFuture<Boolean> clearExpireAsync()
RExpirableAsync
clearExpireAsync
in interface RExpirableAsync
true
if the timeout was cleared and false
if notpublic long remainTimeToLive()
RExpirable
remainTimeToLive
in interface RExpirable
public RFuture<Long> remainTimeToLiveAsync()
RExpirableAsync
remainTimeToLiveAsync
in interface RExpirableAsync
protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
Copyright © 2014–2020 Redisson. All rights reserved.