Package org.redisson.api
Interface RCountDownLatchRx
- All Superinterfaces:
RObjectRx
RxJava2 interface of Redis based
CountDownLatch
It has an advantage over CountDownLatch
--
count can be set via trySetCount(long)
method.- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Completable
await()
Waits until counter reach zero.io.reactivex.rxjava3.core.Single
<Boolean> Waits until counter reach zero or up to definedtimeout
.io.reactivex.rxjava3.core.Completable
Decrements the counter of the latch.io.reactivex.rxjava3.core.Single
<Long> getCount()
Returns value of current count.io.reactivex.rxjava3.core.Single
<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, copy, copy, copyAndReplace, copyAndReplace, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Method Details
-
await
io.reactivex.rxjava3.core.Completable await()Waits until counter reach zero.- Returns:
- void
-
await
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
-
countDown
io.reactivex.rxjava3.core.Completable countDown()Decrements the counter of the latch. Notifies all waiting threads when count reaches zero.- Returns:
- void
-
getCount
io.reactivex.rxjava3.core.Single<Long> getCount()Returns value of current count.- Returns:
- the current count
-
trySetCount
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
-