public interface RCountDownLatch extends RObject, RCountDownLatchAsync
CountDownLatch
It has an advantage over CountDownLatch
--
count can be set via trySetCount(long)
method.Modifier and Type | Method and Description |
---|---|
void |
await()
Waits until counter reach zero.
|
boolean |
await(long timeout,
TimeUnit unit)
Waits until counter reach zero or up to defined
timeout . |
void |
countDown()
Decrements the counter of the latch.
|
long |
getCount()
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.
|
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
awaitAsync, awaitAsync, countDownAsync, getCountAsync, trySetCountAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
void await() throws InterruptedException
InterruptedException
- if the current thread was interruptedboolean await(long timeout, TimeUnit unit) throws InterruptedException
timeout
.timeout
- 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 interruptedvoid countDown()
long getCount()
boolean trySetCount(long count)
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 zeroCopyright © 2014–2021 Redisson. All rights reserved.