Package org.redisson.api
Interface RCountDownLatchReactive
-
- All Superinterfaces:
RObjectRx
public interface RCountDownLatchReactive extends RObjectRx
Reactive interface of Redis basedCountDownLatchIt has an advantage overCountDownLatch-- count can be set viatrySetCount(long)method.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>await()Waits until counter reach zero.reactor.core.publisher.Mono<Boolean>await(long waitTime, TimeUnit unit)Waits until counter reach zero or up to definedtimeout.reactor.core.publisher.Mono<Void>countDown()Decrements the counter of the latch.reactor.core.publisher.Mono<Long>getCount()Returns value of current count.reactor.core.publisher.Mono<Boolean>trySetCount(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.RObjectRx
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
-
-
-
Method Detail
-
await
reactor.core.publisher.Mono<Void> await()
Waits until counter reach zero.- Returns:
- void
-
await
reactor.core.publisher.Mono<Boolean> await(long waitTime, TimeUnit unit)
Waits until counter reach zero or up to definedtimeout.- Parameters:
waitTime- the maximum time to waitunit- the time unit- Returns:
trueif the count reached zero andfalseif timeout reached before the count reached zero
-
countDown
reactor.core.publisher.Mono<Void> countDown()
Decrements the counter of the latch. Notifies all waiting threads when count reaches zero.- Returns:
- void
-
getCount
reactor.core.publisher.Mono<Long> getCount()
Returns value of current count.- Returns:
- the current count
-
trySetCount
reactor.core.publisher.Mono<Boolean> trySetCount(long count)
Sets new count value only if previous count already has reached zero or is not set at all.- Parameters:
count- - number of timescountDownmust be invoked before threads can pass throughawait- Returns:
trueif new count settedfalseif previous count has not reached zero
-
-