Package org.redisson.api
Interface RCountDownLatchAsync
-
- All Superinterfaces:
RObjectAsync
- All Known Subinterfaces:
RCountDownLatch
- All Known Implementing Classes:
RedissonCountDownLatch
public interface RCountDownLatchAsync extends RObjectAsync
Async interface of Redis basedCountDownLatch
It has an advantage overCountDownLatch
-- count can be set viatrySetCountAsync(long)
method.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RFuture<Void>
awaitAsync()
Waits until counter reach zero.RFuture<Boolean>
awaitAsync(long waitTime, TimeUnit unit)
Waits until counter reach zero or up to definedtimeout
.RFuture<Void>
countDownAsync()
Decrements the counter of the latch.RFuture<Long>
getCountAsync()
Returns value of current count.RFuture<Boolean>
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 Detail
-
awaitAsync
RFuture<Boolean> awaitAsync(long waitTime, TimeUnit unit)
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
RFuture<Void> countDownAsync()
Decrements the counter of the latch. Notifies all waiting threads when count reaches zero.- Returns:
- void
-
getCountAsync
RFuture<Long> getCountAsync()
Returns value of current count.- Returns:
- the current count
-
trySetCountAsync
RFuture<Boolean> trySetCountAsync(long count)
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
-
-