Package org.redisson.api
Interface RCountDownLatchAsync
- All Superinterfaces:
RObjectAsync
- All Known Subinterfaces:
RCountDownLatch
- All Known Implementing Classes:
RedissonCountDownLatch
Async interface of Redis based
CountDownLatch
It has an advantage over CountDownLatch
--
count can be set via trySetCountAsync(long)
method.- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionWaits until counter reach zero.awaitAsync
(long waitTime, TimeUnit unit) Waits until counter reach zero or up to definedtimeout
.Decrements the counter of the latch.Returns value of current count.trySetCountAsync
(long count) Sets new count value only if previous count already has reached zero or is not set at all.Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Method Details
-
awaitAsync
Waits until counter reach zero.- Returns:
- void
-
awaitAsync
Waits until counter reach zero or up to definedtimeout
.- Parameters:
waitTime
- the maximum time to waitunit
- the time unit- Returns:
true
if the count reached zero andfalse
if timeout reached before the count reached zero
-
countDownAsync
Decrements the counter of the latch. Notifies all waiting threads when count reaches zero.- Returns:
- void
-
getCountAsync
Returns value of current count.- Returns:
- the current count
-
trySetCountAsync
Sets new count value only if previous count already has reached zero or is not set at all.- Parameters:
count
- - number of timescountDown
must be invoked before threads can pass throughawait
- Returns:
true
if new count settedfalse
if previous count has not reached zero
-