Class DefaultAtomicCounter

    • Constructor Detail

      • DefaultAtomicCounter

        public DefaultAtomicCounter​(AsyncAtomicCounter asyncCounter,
                                    long operationTimeoutMillis)
    • Method Detail

      • incrementAndGet

        public long incrementAndGet()
        Description copied from interface: AtomicCounter
        Atomically increment by one the current value.
        Specified by:
        incrementAndGet in interface AtomicCounter
        Returns:
        updated value
      • getAndIncrement

        public long getAndIncrement()
        Description copied from interface: AtomicCounter
        Atomically increment by one the current value.
        Specified by:
        getAndIncrement in interface AtomicCounter
        Returns:
        previous value
      • getAndAdd

        public long getAndAdd​(long delta)
        Description copied from interface: AtomicCounter
        Atomically adds the given value to the current value.
        Specified by:
        getAndAdd in interface AtomicCounter
        Parameters:
        delta - the value to add
        Returns:
        previous value
      • addAndGet

        public long addAndGet​(long delta)
        Description copied from interface: AtomicCounter
        Atomically adds the given value to the current value.
        Specified by:
        addAndGet in interface AtomicCounter
        Parameters:
        delta - the value to add
        Returns:
        updated value
      • set

        public void set​(long value)
        Description copied from interface: AtomicCounter
        Atomically sets the given value to the current value.
        Specified by:
        set in interface AtomicCounter
        Parameters:
        value - the value to set
      • compareAndSet

        public boolean compareAndSet​(long expectedValue,
                                     long updateValue)
        Description copied from interface: AtomicCounter
        Atomically sets the given counter to the updated value if the current value is the expected value, otherwise no change occurs.
        Specified by:
        compareAndSet in interface AtomicCounter
        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
      • get

        public long get()
        Description copied from interface: AtomicCounter
        Returns the current value of the counter without modifying it.
        Specified by:
        get in interface AtomicCounter
        Returns:
        current value