public class RedissonCountDownLatch extends RedissonObject implements RCountDownLatch
CountDownLatch
It has a advantage over CountDownLatch
--
count can be reset via trySetCount(long)
.codec, commandExecutor, name
Modifier | Constructor and Description |
---|---|
protected |
RedissonCountDownLatch(CommandAsyncExecutor commandExecutor,
String name) |
Modifier and Type | Method and Description |
---|---|
void |
await()
Waits until counter reach zero.
|
boolean |
await(long time,
TimeUnit unit)
Waits until counter reach zero or up to defined
timeout . |
RFuture<Void> |
awaitAsync()
Waits until counter reach zero.
|
RFuture<Boolean> |
awaitAsync(long waitTime,
TimeUnit unit)
Waits until counter reach zero or up to defined
timeout . |
void |
countDown()
Decrements the counter of the latch.
|
RFuture<Void> |
countDownAsync()
Decrements the counter of the latch.
|
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
long |
getCount()
Returns value of current count.
|
RFuture<Long> |
getCountAsync()
Returns value of current count.
|
boolean |
trySetCount(long count)
Sets new count value only if previous count already has reached zero
or is not set at all.
|
RFuture<Boolean> |
trySetCountAsync(long count)
Sets new count value only if previous count already has reached zero
or is not set at all.
|
addListener, addListener, addListenerAsync, addListenerAsync, copy, copyAsync, delete, 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, copy, delete, dump, getCodec, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
addListenerAsync, copyAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
protected RedissonCountDownLatch(CommandAsyncExecutor commandExecutor, String name)
public void await() throws InterruptedException
RCountDownLatch
await
in interface RCountDownLatch
InterruptedException
- if the current thread was interruptedpublic RFuture<Void> awaitAsync()
RCountDownLatchAsync
awaitAsync
in interface RCountDownLatchAsync
public boolean await(long time, TimeUnit unit) throws InterruptedException
RCountDownLatch
timeout
.await
in interface RCountDownLatch
time
- the maximum time to waitunit
- the time unittrue
if the count reached zero and false
if timeout reached before the count reached zeroInterruptedException
- if the current thread was interruptedpublic RFuture<Boolean> awaitAsync(long waitTime, TimeUnit unit)
RCountDownLatchAsync
timeout
.awaitAsync
in interface RCountDownLatchAsync
waitTime
- the maximum time to waitunit
- the time unittrue
if the count reached zero and false
if timeout reached before the count reached zeropublic void countDown()
RCountDownLatch
countDown
in interface RCountDownLatch
public RFuture<Void> countDownAsync()
RCountDownLatchAsync
countDownAsync
in interface RCountDownLatchAsync
public long getCount()
RCountDownLatch
getCount
in interface RCountDownLatch
public RFuture<Long> getCountAsync()
RCountDownLatchAsync
getCountAsync
in interface RCountDownLatchAsync
public boolean trySetCount(long count)
RCountDownLatch
trySetCount
in interface RCountDownLatch
count
- - number of times RCountDownLatch.countDown()
must be invoked
before threads can pass through RCountDownLatch.await()
true
if new count setted
false
if previous count has not reached zeropublic RFuture<Boolean> trySetCountAsync(long count)
RCountDownLatchAsync
trySetCountAsync
in interface RCountDownLatchAsync
count
- - number of times countDown
must be invoked
before threads can pass through await
true
if new count setted
false
if previous count has not reached zeropublic RFuture<Boolean> deleteAsync()
RObjectAsync
deleteAsync
in interface RObjectAsync
deleteAsync
in class RedissonObject
true
if object was deleted false
if notCopyright © 2014–2020 Redisson. All rights reserved.