public interface RCountDownLatchAsync extends RObjectAsync
CountDownLatch
It has an advantage over CountDownLatch
--
count can be set via trySetCountAsync(long)
method.Modifier and Type | Method and Description |
---|---|
RFuture<Void> |
awaitAsync()
Causes the current thread to wait until the latch has counted down to
zero.
|
RFuture<Boolean> |
awaitAsync(long waitTime,
TimeUnit unit)
Causes the current thread to wait until the latch has counted down to
zero or the specified waiting time elapses.
|
RFuture<Void> |
countDownAsync()
Decrements the count of the latch, releasing all waiting threads if
the count reaches zero.
|
RFuture<Long> |
getCountAsync()
Returns the 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.
|
addListenerAsync, copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
RFuture<Void> awaitAsync()
If the current count is zero then this method returns immediately.
If the current count is greater than zero then the current
thread becomes disabled for thread scheduling purposes and lies
dormant until the count reaches zero due to invocations of the
countDownAsync()
method.
RFuture<Boolean> awaitAsync(long waitTime, TimeUnit unit)
If the current count is zero then this method returns immediately
with the value true
.
If the current count is greater than zero then the current
thread becomes disabled for thread scheduling purposes and lies
dormant until the count reaches zero due to invocations of the
countDownAsync()
method or the specified waiting time elapses.
If the count reaches zero then the method returns with the
value true
.
If the specified waiting time elapses then the value false
is returned. If the time is less than or equal to zero, the method
will not wait at all.
waitTime
- the maximum time to waitunit
- the time unit of the timeout
argumenttrue
if the count reached zero and false
if the waiting time elapsed before the count reached zeroRFuture<Void> countDownAsync()
If the current count is greater than zero then it is decremented. If the new count is zero then all waiting threads are re-enabled for thread scheduling purposes.
If the current count equals zero then nothing happens.
RFuture<Long> getCountAsync()
This method is typically used for debugging and testing purposes.
RFuture<Boolean> trySetCountAsync(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–2019 Redisson. All rights reserved.