Interface AsyncAtomicCounter

    • Method Detail

      • incrementAndGet

        CompletableFuture<Long> incrementAndGet()
        Atomically increment by one the current value.
        Returns:
        updated value
      • getAndIncrement

        CompletableFuture<Long> getAndIncrement()
        Atomically increment by one the current value.
        Returns:
        previous value
      • getAndAdd

        CompletableFuture<Long> getAndAdd​(long delta)
        Atomically adds the given value to the current value.
        Parameters:
        delta - the value to add
        Returns:
        previous value
      • addAndGet

        CompletableFuture<Long> addAndGet​(long delta)
        Atomically adds the given value to the current value.
        Parameters:
        delta - the value to add
        Returns:
        updated value
      • get

        CompletableFuture<Long> get()
        Returns the current value of the counter without modifying it.
        Returns:
        current value
      • set

        CompletableFuture<Void> set​(long value)
        Atomically sets the given value to the current value.
        Parameters:
        value - new value
        Returns:
        future void
      • compareAndSet

        CompletableFuture<Boolean> compareAndSet​(long expectedValue,
                                                 long updateValue)
        Atomically sets the given counter to the updated value if the current value is the expected value, otherwise no change occurs.
        Parameters:
        expectedValue - the expected current value of the counter
        updateValue - the new value to be set
        Returns:
        true if the update occurred and the expected value was equal to the current value, false otherwise
      • asAtomicCounter

        default AtomicCounter asAtomicCounter​(long timeoutMillis)
        Returns a new AtomicCounter that is backed by this instance.
        Parameters:
        timeoutMillis - timeout duration for the returned ConsistentMap operations
        Returns:
        new ConsistentMap instance
      • asAtomicCounter

        default AtomicCounter asAtomicCounter()
        Returns a new AtomicCounter that is backed by this instance and with a default operation timeout.
        Returns:
        new ConsistentMap instance