Interface RCountDownLatchAsync

All Superinterfaces:
RObjectAsync
All Known Subinterfaces:
RCountDownLatch
All Known Implementing Classes:
RedissonCountDownLatch

public interface RCountDownLatchAsync extends RObjectAsync
Async interface of Redis based CountDownLatch It has an advantage over CountDownLatch -- count can be set via trySetCountAsync(long) method.
Author:
Nikita Koksharov
  • Method Details

    • awaitAsync

      RFuture<Void> awaitAsync()
      Waits until counter reach zero.
      Returns:
      void
    • awaitAsync

      RFuture<Boolean> awaitAsync(long waitTime, TimeUnit unit)
      Waits until counter reach zero or up to defined timeout.
      Parameters:
      waitTime - the maximum time to wait
      unit - the time unit
      Returns:
      true if the count reached zero and false 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 times countDown must be invoked before threads can pass through await
      Returns:
      true if new count setted false if previous count has not reached zero