Interface LiveCounter


public interface LiveCounter
The LiveCounter interface provides methods to interact with a live counter. It allows incrementing, decrementing, and retrieving the current value of the counter, both synchronously and asynchronously.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Decrements the value of the counter by 1.
    void
    decrementAsync(@NotNull Callback<Void> callback)
    Decrements the value of the counter by 1 asynchronously.
    void
    Increments the value of the counter by 1.
    void
    incrementAsync(@NotNull Callback<Void> callback)
    Increments the value of the counter by 1 asynchronously.
    @NotNull Long
    Retrieves the current value of the counter.
  • Method Details

    • increment

      @Blocking void increment()
      Increments the value of the counter by 1. Send a COUNTER_INC operation to the realtime system to increment a value on this LiveCounter object. This does not modify the underlying data of this LiveCounter object. Instead, the change will be applied when the published COUNTER_INC operation is echoed back to the client and applied to the object following the regular operation application procedure.
    • incrementAsync

      @NonBlocking void incrementAsync(@NotNull @NotNull Callback<Void> callback)
      Increments the value of the counter by 1 asynchronously. Send a COUNTER_INC operation to the realtime system to increment a value on this LiveCounter object. This does not modify the underlying data of this LiveCounter object. Instead, the change will be applied when the published COUNTER_INC operation is echoed back to the client and applied to the object following the regular operation application procedure.
      Parameters:
      callback - the callback to be invoked upon completion of the operation.
    • decrement

      @Blocking void decrement()
      Decrements the value of the counter by 1. An alias for calling increment() with a negative amount.
    • decrementAsync

      @NonBlocking void decrementAsync(@NotNull @NotNull Callback<Void> callback)
      Decrements the value of the counter by 1 asynchronously. An alias for calling increment() with a negative amount.
      Parameters:
      callback - the callback to be invoked upon completion of the operation.
    • value

      @NotNull @Contract(pure=true) @NotNull Long value()
      Retrieves the current value of the counter.
      Returns:
      the current value of the counter as a Long.