public class RedissonCountDownLatch extends RedissonObject implements RCountDownLatch
CountDownLatch
It has a advantage over CountDownLatch --
count can be reset via trySetCount(long).codec, commandExecutor, name| Modifier | Constructor and Description |
|---|---|
protected |
RedissonCountDownLatch(CommandAsyncExecutor commandExecutor,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
await()
Causes the current thread to wait until the latch has counted down to
zero, unless the thread is interrupted.
|
boolean |
await(long time,
TimeUnit unit)
Causes the current thread to wait until the latch has counted down to
zero, unless the thread is interrupted,
or the specified waiting time elapses.
|
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.
|
void |
countDown()
Decrements the count of the latch, releasing all waiting threads if
the count reaches zero.
|
RFuture<Void> |
countDownAsync()
Decrements the count of the latch, releasing all waiting threads if
the count reaches zero.
|
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
long |
getCount()
Returns the current count.
|
RFuture<Long> |
getCountAsync()
Returns the current count.
|
boolean |
trySetCount(long count)
Sets new count value only if previous count already has reached zero
or is not set at all.
|
RFuture<Boolean> |
trySetCountAsync(long count)
Sets new count value only if previous count already has reached zero
or is not set at all.
|
addListener, addListenerAsync, copy, copyAsync, delete, dump, dumpAsync, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getLockByMapKey, getLockByValue, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsyncclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListener, copy, delete, dump, getCodec, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlinkaddListenerAsync, copyAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsyncprotected RedissonCountDownLatch(CommandAsyncExecutor commandExecutor, String name)
public void await()
throws InterruptedException
RCountDownLatchIf 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 one of two things happen:
RCountDownLatch.countDown() method; or
If the current thread:
InterruptedException is thrown and the current thread's
interrupted status is cleared.await in interface RCountDownLatchInterruptedException - if the current thread is interrupted
while waitingpublic RFuture<Void> awaitAsync()
RCountDownLatchAsyncIf 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
RCountDownLatchAsync.countDownAsync() method.
awaitAsync in interface RCountDownLatchAsyncpublic boolean await(long time,
TimeUnit unit)
throws InterruptedException
RCountDownLatchIf 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 one of three things happen:
RCountDownLatch.countDown() method; or
If the count reaches zero then the method returns with the
value true.
If the current thread:
InterruptedException is thrown and the current thread's
interrupted status is cleared.
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.
await in interface RCountDownLatchtime - 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 zeroInterruptedException - if the current thread is interrupted
while waitingpublic RFuture<Boolean> awaitAsync(long waitTime, TimeUnit unit)
RCountDownLatchAsyncIf 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
RCountDownLatchAsync.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.
awaitAsync in interface RCountDownLatchAsyncwaitTime - 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 zeropublic void countDown()
RCountDownLatchIf 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.
countDown in interface RCountDownLatchpublic RFuture<Void> countDownAsync()
RCountDownLatchAsyncIf 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.
countDownAsync in interface RCountDownLatchAsyncpublic long getCount()
RCountDownLatchThis method is typically used for debugging and testing purposes.
getCount in interface RCountDownLatchpublic RFuture<Long> getCountAsync()
RCountDownLatchAsyncThis method is typically used for debugging and testing purposes.
getCountAsync in interface RCountDownLatchAsyncpublic boolean trySetCount(long count)
RCountDownLatchtrySetCount in interface RCountDownLatchcount - - number of times RCountDownLatch.countDown() must be invoked
before threads can pass through RCountDownLatch.await()true if new count setted
false if previous count has not reached zeropublic RFuture<Boolean> trySetCountAsync(long count)
RCountDownLatchAsynctrySetCountAsync in interface RCountDownLatchAsynccount - - number of times countDown must be invoked
before threads can pass through awaittrue if new count setted
false if previous count has not reached zeropublic RFuture<Boolean> deleteAsync()
RObjectAsyncdeleteAsync in interface RObjectAsyncdeleteAsync in class RedissonObjecttrue if object was deleted false if notCopyright © 2014–2019 Redisson. All rights reserved.