com.hazelcast.concurrent.atomiclong

## Class AtomicLongProxy

- java.lang.Object
- - com.hazelcast.spi.AbstractDistributedObject<AtomicLongService>
  - - com.hazelcast.concurrent.atomiclong.AtomicLongProxy

- All Implemented Interfaces:
    AsyncAtomicLong, DistributedObject, IAtomicLong

      public class AtomicLongProxy
      extends AbstractDistributedObject<AtomicLongService>
      implements AsyncAtomicLong

- - ### Field Summary

    - ### Fields inherited from class com.hazelcast.spi.AbstractDistributedObject

      `PARTITIONING_STRATEGY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AtomicLongProxy(String name, NodeEngine nodeEngine, AtomicLongService service)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `addAndGet(long delta)` Atomically adds the given value to the current value.
    `InternalCompletableFuture<Long>` | `addAndGetAsync(long delta)` Atomically adds the given value to the current value.
    `void` | `alter(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it.
    `long` | `alterAndGet(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it and gets the result.
    `InternalCompletableFuture<Long>` | `alterAndGetAsync(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it and gets the result.
    `InternalCompletableFuture<Void>` | `alterAsync(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it.
    `<R> R` | `apply(IFunction<Long,R> function)` Applies a function on the value, the actual stored value will not change.
    `<R> InternalCompletableFuture<R>` | `applyAsync(IFunction<Long,R> function)` Applies a function on the value, the actual stored value will not change.
    `InternalCompletableFuture<Long>` | `asyncAddAndGet(long delta)` Atomically adds the given value to the current value.
    `InternalCompletableFuture<Void>` | `asyncAlter(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it.
    `InternalCompletableFuture<Long>` | `asyncAlterAndGet(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it and gets the result.
    `<R> InternalCompletableFuture<R>` | `asyncApply(IFunction<Long,R> function)` Applies a function on the value, the actual stored value will not change.
    `InternalCompletableFuture<Boolean>` | `asyncCompareAndSet(long expect, long update)` Atomically sets the value to the given updated value only if the current value `==` the expected value.
    `InternalCompletableFuture<Long>` | `asyncDecrementAndGet()` Atomically decrements the current value by one.
    `InternalCompletableFuture<Long>` | `asyncGet()` Gets the current value.
    `InternalCompletableFuture<Long>` | `asyncGetAndAdd(long delta)` Atomically adds the given value to the current value.
    `InternalCompletableFuture<Long>` | `asyncGetAndAlter(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it on and gets the old value.
    `InternalCompletableFuture<Long>` | `asyncGetAndIncrement()` Atomically increments the current value by one.
    `InternalCompletableFuture<Long>` | `asyncGetAndSet(long newValue)` Atomically sets the given value and returns the old value.
    `InternalCompletableFuture<Long>` | `asyncIncrementAndGet()` Atomically increments the current value by one.
    `InternalCompletableFuture<Void>` | `asyncSet(long newValue)` Atomically sets the given value.
    `boolean` | `compareAndSet(long expect, long update)` Atomically sets the value to the given updated value only if the current value `==` the expected value.
    `InternalCompletableFuture<Boolean>` | `compareAndSetAsync(long expect, long update)` Atomically sets the value to the given updated value only if the current value `==` the expected value.
    `long` | `decrementAndGet()` Atomically decrements the current value by one.
    `InternalCompletableFuture<Long>` | `decrementAndGetAsync()` Atomically decrements the current value by one.
    `long` | `get()` Gets the current value.
    `long` | `getAndAdd(long delta)` Atomically adds the given value to the current value.
    `InternalCompletableFuture<Long>` | `getAndAddAsync(long delta)` Atomically adds the given value to the current value.
    `long` | `getAndAlter(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it on and gets the old value.
    `InternalCompletableFuture<Long>` | `getAndAlterAsync(IFunction<Long,Long> function)` Alters the currently stored value by applying a function on it on and gets the old value.
    `long` | `getAndIncrement()` Atomically increments the current value by one.
    `InternalCompletableFuture<Long>` | `getAndIncrementAsync()` Atomically increments the current value by one.
    `long` | `getAndSet(long newValue)` Atomically sets the given value and returns the old value.
    `InternalCompletableFuture<Long>` | `getAndSetAsync(long newValue)` Atomically sets the given value and returns the old value.
    `InternalCompletableFuture<Long>` | `getAsync()` Gets the current value.
    `String` | `getName()` Returns the name of this IAtomicLong instance.
    `int` | `getPartitionId()`
    `String` | `getServiceName()` Returns the service name for this object.
    `long` | `incrementAndGet()` Atomically increments the current value by one.
    `InternalCompletableFuture<Long>` | `incrementAndGetAsync()` Atomically increments the current value by one.
    `void` | `set(long newValue)` Atomically sets the given value.
    `InternalCompletableFuture<Void>` | `setAsync(long newValue)` Atomically sets the given value.
    `String` | `toString()`

    - ### Methods inherited from class com.hazelcast.spi.AbstractDistributedObject

      `destroy, equals, getDistributedObjectName, getNameAsPartitionAwareData, getNodeEngine, getOperationService, getPartitionId, getPartitionKey, getService, hashCode, invalidate, invokeOnPartition, isClusterVersionEqualTo, isClusterVersionGreaterOrEqual, isClusterVersionGreaterThan, isClusterVersionLessOrEqual, isClusterVersionLessThan, isClusterVersionUnknown, isClusterVersionUnknownOrGreaterOrEqual, isClusterVersionUnknownOrGreaterThan, isClusterVersionUnknownOrLessOrEqual, isClusterVersionUnknownOrLessThan, postDestroy, preDestroy, throwNotActiveException, toData`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.hazelcast.core.DistributedObject

      `destroy, getPartitionKey`

- - ### Constructor Detail

    - #### AtomicLongProxy

          public AtomicLongProxy(String name,
                                 NodeEngine nodeEngine,
                                 AtomicLongService service)

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `IAtomicLong`
      Returns the name of this IAtomicLong instance.
      Specified by:
        `getName` in interface `DistributedObject`
      Specified by:
        `getName` in interface `IAtomicLong`
      Returns:
        the name of this IAtomicLong instance

    - #### getPartitionId

          public int getPartitionId()

    - #### getServiceName

          public String getServiceName()

      Description copied from interface: `DistributedObject`
      Returns the service name for this object.
      Specified by:
        `getServiceName` in interface `DistributedObject`
      Specified by:
        `getServiceName` in class `AbstractDistributedObject<AtomicLongService>`
      Returns:
        the service name for this object.

    - #### addAndGet

          public long addAndGet(long delta)

      Description copied from interface: `IAtomicLong`
      Atomically adds the given value to the current value.
      Specified by:
        `addAndGet` in interface `IAtomicLong`
      Parameters:
        `delta` - the value to add to the current value
      Returns:
        the updated value, the given value added to the current value

    - #### addAndGetAsync

          public InternalCompletableFuture<Long> addAndGetAsync(long delta)

      Description copied from interface: `IAtomicLong`
      Atomically adds the given value to the current value.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      The operations result can be obtained in a blocking way, or a callback can be provided for execution upon completion, as demonstrated in the following examples:

           ICompletableFuture future = atomicLong.addAndGetAsync(13);
           // do something else, then read the result

           // this method will block until the result is available
           Long result = future.get();

           ICompletableFuture future = atomicLong.addAndGetAsync(13);
           future.andThen(new ExecutionCallback<Long>() {
               void onResponse(Long response) {
                   // do something with the result
               }

               void onFailure(Throwable t) {
                   // handle failure
               }
           });

      Specified by:
        `addAndGetAsync` in interface `IAtomicLong`
      Parameters:
        `delta` - the value to add
      Returns:
        an `ICompletableFuture` bearing the response

    - #### asyncAddAndGet

          public InternalCompletableFuture<Long> asyncAddAndGet(long delta)

      Description copied from interface: `AsyncAtomicLong`
      Atomically adds the given value to the current value.
      Specified by:
        `asyncAddAndGet` in interface `AsyncAtomicLong`
      Parameters:
        `delta` - the value to add
      Returns:
        the updated value

    - #### compareAndSet

          public boolean compareAndSet(long expect,
                                       long update)

      Description copied from interface: `IAtomicLong`
      Atomically sets the value to the given updated value only if the current value `==` the expected value.
      Specified by:
        `compareAndSet` in interface `IAtomicLong`
      Parameters:
        `expect` - the expected value
        `update` - the new value
      Returns:
        `true` if successful; or `false` if the actual value was not equal to the expected value.

    - #### compareAndSetAsync

          public InternalCompletableFuture<Boolean> compareAndSetAsync(long expect,
                                                                       long update)

      Description copied from interface: `IAtomicLong`
      Atomically sets the value to the given updated value only if the current value `==` the expected value.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `compareAndSetAsync` in interface `IAtomicLong`
      Parameters:
        `expect` - the expected value
        `update` - the new value
      Returns:
        an `ICompletableFuture` with value `true` if successful; or `false` if the actual value was not equal to the expected value

    - #### asyncCompareAndSet

          public InternalCompletableFuture<Boolean> asyncCompareAndSet(long expect,
                                                                       long update)

      Description copied from interface: `AsyncAtomicLong`
      Atomically sets the value to the given updated value only if the current value `==` the expected value.
      Specified by:
        `asyncCompareAndSet` in interface `AsyncAtomicLong`
      Parameters:
        `expect` - the expected value
        `update` - the new value
      Returns:
        true if successful; or false if the actual value was not equal to the expected value.

    - #### set

          public void set(long newValue)

      Description copied from interface: `IAtomicLong`
      Atomically sets the given value.
      Specified by:
        `set` in interface `IAtomicLong`
      Parameters:
        `newValue` - the new value

    - #### setAsync

          public InternalCompletableFuture<Void> setAsync(long newValue)

      Description copied from interface: `IAtomicLong`
      Atomically sets the given value.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `setAsync` in interface `IAtomicLong`
      Parameters:
        `newValue` - the new value
      Returns:
        an `ICompletableFuture`

    - #### asyncSet

          public InternalCompletableFuture<Void> asyncSet(long newValue)

      Description copied from interface: `AsyncAtomicLong`
      Atomically sets the given value.
      Specified by:
        `asyncSet` in interface `AsyncAtomicLong`
      Parameters:
        `newValue` - the new value

    - #### getAndSet

          public long getAndSet(long newValue)

      Description copied from interface: `IAtomicLong`
      Atomically sets the given value and returns the old value.
      Specified by:
        `getAndSet` in interface `IAtomicLong`
      Parameters:
        `newValue` - the new value
      Returns:
        the old value

    - #### getAndSetAsync

          public InternalCompletableFuture<Long> getAndSetAsync(long newValue)

      Description copied from interface: `IAtomicLong`
      Atomically sets the given value and returns the old value.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `getAndSetAsync` in interface `IAtomicLong`
      Parameters:
        `newValue` - the new value
      Returns:
        an `ICompletableFuture` with the old value

    - #### asyncGetAndSet

          public InternalCompletableFuture<Long> asyncGetAndSet(long newValue)

      Description copied from interface: `AsyncAtomicLong`
      Atomically sets the given value and returns the old value.
      Specified by:
        `asyncGetAndSet` in interface `AsyncAtomicLong`
      Parameters:
        `newValue` - the new value
      Returns:
        the old value

    - #### getAndAdd

          public long getAndAdd(long delta)

      Description copied from interface: `IAtomicLong`
      Atomically adds the given value to the current value.
      Specified by:
        `getAndAdd` in interface `IAtomicLong`
      Parameters:
        `delta` - the value to add to the current value
      Returns:
        the old value before the add

    - #### getAndAddAsync

          public InternalCompletableFuture<Long> getAndAddAsync(long delta)

      Description copied from interface: `IAtomicLong`
      Atomically adds the given value to the current value.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `getAndAddAsync` in interface `IAtomicLong`
      Parameters:
        `delta` - the value to add
      Returns:
        an `ICompletableFuture` with the old value before the addition

    - #### asyncGetAndAdd

          public InternalCompletableFuture<Long> asyncGetAndAdd(long delta)

      Description copied from interface: `AsyncAtomicLong`
      Atomically adds the given value to the current value.
      Specified by:
        `asyncGetAndAdd` in interface `AsyncAtomicLong`
      Parameters:
        `delta` - the value to add
      Returns:
        the old value before the add

    - #### decrementAndGet

          public long decrementAndGet()

      Description copied from interface: `IAtomicLong`
      Atomically decrements the current value by one.
      Specified by:
        `decrementAndGet` in interface `IAtomicLong`
      Returns:
        the updated value, the current value decremented by one

    - #### decrementAndGetAsync

          public InternalCompletableFuture<Long> decrementAndGetAsync()

      Description copied from interface: `IAtomicLong`
      Atomically decrements the current value by one.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `decrementAndGetAsync` in interface `IAtomicLong`
      Returns:
        an `ICompletableFuture` with the updated value

    - #### asyncDecrementAndGet

          public InternalCompletableFuture<Long> asyncDecrementAndGet()

      Description copied from interface: `AsyncAtomicLong`
      Atomically decrements the current value by one.
      Specified by:
        `asyncDecrementAndGet` in interface `AsyncAtomicLong`
      Returns:
        the updated value

    - #### get

          public long get()

      Description copied from interface: `IAtomicLong`
      Gets the current value.
      Specified by:
        `get` in interface `IAtomicLong`
      Returns:
        the current value

    - #### getAsync

          public InternalCompletableFuture<Long> getAsync()

      Description copied from interface: `IAtomicLong`
      Gets the current value. This method will dispatch a request and return immediately an `ICompletableFuture`.
      Specified by:
        `getAsync` in interface `IAtomicLong`
      Returns:
        an `ICompletableFuture` with the current value

    - #### asyncGet

          public InternalCompletableFuture<Long> asyncGet()

      Description copied from interface: `AsyncAtomicLong`
      Gets the current value.
      Specified by:
        `asyncGet` in interface `AsyncAtomicLong`
      Returns:
        the current value

    - #### incrementAndGet

          public long incrementAndGet()

      Description copied from interface: `IAtomicLong`
      Atomically increments the current value by one.
      Specified by:
        `incrementAndGet` in interface `IAtomicLong`
      Returns:
        the updated value, the current value incremented by one

    - #### incrementAndGetAsync

          public InternalCompletableFuture<Long> incrementAndGetAsync()

      Description copied from interface: `IAtomicLong`
      Atomically increments the current value by one.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `incrementAndGetAsync` in interface `IAtomicLong`
      Returns:
        an `ICompletableFuture` with the updated value

    - #### asyncIncrementAndGet

          public InternalCompletableFuture<Long> asyncIncrementAndGet()

      Description copied from interface: `AsyncAtomicLong`
      Atomically increments the current value by one.
      Specified by:
        `asyncIncrementAndGet` in interface `AsyncAtomicLong`
      Returns:
        the updated value

    - #### getAndIncrement

          public long getAndIncrement()

      Description copied from interface: `IAtomicLong`
      Atomically increments the current value by one.
      Specified by:
        `getAndIncrement` in interface `IAtomicLong`
      Returns:
        the old value

    - #### getAndIncrementAsync

          public InternalCompletableFuture<Long> getAndIncrementAsync()

      Description copied from interface: `IAtomicLong`
      Atomically increments the current value by one.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `getAndIncrementAsync` in interface `IAtomicLong`
      Returns:
        an `ICompletableFuture` with the old value

    - #### asyncGetAndIncrement

          public InternalCompletableFuture<Long> asyncGetAndIncrement()

      Description copied from interface: `AsyncAtomicLong`
      Atomically increments the current value by one.
      Specified by:
        `asyncGetAndIncrement` in interface `AsyncAtomicLong`
      Returns:
        the old value

    - #### alter

          public void alter(IFunction<Long,Long> function)

      Description copied from interface: `IAtomicLong`
      Alters the currently stored value by applying a function on it.
      Specified by:
        `alter` in interface `IAtomicLong`
      Parameters:
        `function` - the function applied to the currently stored value

    - #### alterAsync

          public InternalCompletableFuture<Void> alterAsync(IFunction<Long,Long> function)

      Description copied from interface: `IAtomicLong`
      Alters the currently stored value by applying a function on it.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `alterAsync` in interface `IAtomicLong`
      Parameters:
        `function` - the function
      Returns:
        an `ICompletableFuture` with the new value

    - #### asyncAlter

          public InternalCompletableFuture<Void> asyncAlter(IFunction<Long,Long> function)

      Description copied from interface: `AsyncAtomicLong`
      Alters the currently stored value by applying a function on it.
      Specified by:
        `asyncAlter` in interface `AsyncAtomicLong`
      Parameters:
        `function` - the function

    - #### alterAndGet

          public long alterAndGet(IFunction<Long,Long> function)

      Description copied from interface: `IAtomicLong`
      Alters the currently stored value by applying a function on it and gets the result.
      Specified by:
        `alterAndGet` in interface `IAtomicLong`
      Parameters:
        `function` - the function applied to the currently stored value
      Returns:
        the new value

    - #### alterAndGetAsync

          public InternalCompletableFuture<Long> alterAndGetAsync(IFunction<Long,Long> function)

      Description copied from interface: `IAtomicLong`
      Alters the currently stored value by applying a function on it and gets the result.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `alterAndGetAsync` in interface `IAtomicLong`
      Parameters:
        `function` - the function
      Returns:
        an `ICompletableFuture` with the new value

    - #### asyncAlterAndGet

          public InternalCompletableFuture<Long> asyncAlterAndGet(IFunction<Long,Long> function)

      Description copied from interface: `AsyncAtomicLong`
      Alters the currently stored value by applying a function on it and gets the result.
      Specified by:
        `asyncAlterAndGet` in interface `AsyncAtomicLong`
      Parameters:
        `function` - the function
      Returns:
        the new value.

    - #### getAndAlter

          public long getAndAlter(IFunction<Long,Long> function)

      Description copied from interface: `IAtomicLong`
      Alters the currently stored value by applying a function on it on and gets the old value.
      Specified by:
        `getAndAlter` in interface `IAtomicLong`
      Parameters:
        `function` - the function applied to the currently stored value
      Returns:
        the old value

    - #### getAndAlterAsync

          public InternalCompletableFuture<Long> getAndAlterAsync(IFunction<Long,Long> function)

      Description copied from interface: `IAtomicLong`
      Alters the currently stored value by applying a function on it on and gets the old value.

      This method will dispatch a request and return immediately an `ICompletableFuture`.

      Specified by:
        `getAndAlterAsync` in interface `IAtomicLong`
      Parameters:
        `function` - the function
      Returns:
        an `ICompletableFuture` with the old value

    - #### asyncGetAndAlter

          public InternalCompletableFuture<Long> asyncGetAndAlter(IFunction<Long,Long> function)

      Description copied from interface: `AsyncAtomicLong`
      Alters the currently stored value by applying a function on it on and gets the old value.
      Specified by:
        `asyncGetAndAlter` in interface `AsyncAtomicLong`
      Parameters:
        `function` - the function
      Returns:
        the old value

    - #### apply

          public <R> R apply(IFunction<Long,R> function)

      Description copied from interface: `IAtomicLong`
      Applies a function on the value, the actual stored value will not change.
      Specified by:
        `apply` in interface `IAtomicLong`
      Parameters:
        `function` - the function applied to the value, the value is not changed
      Returns:
        the result of the function application

    - #### applyAsync

          public <R> InternalCompletableFuture<R> applyAsync(IFunction<Long,R> function)

      Description copied from interface: `IAtomicLong`
      Applies a function on the value, the actual stored value will not change.

      This method will dispatch a request and return immediately an `ICompletableFuture`. For example:

           class IsOneFunction implements IFunction {
               @Override
               public Boolean apply(Long input) {
                   return input.equals(1L);
               }
           }

           ICompletableFuture future = atomicLong.applyAsync(new IsOneFunction());
           future.andThen(new ExecutionCallback<;Boolean>() {
              void onResponse(Boolean response) {
                  // do something with the response
              }

              void onFailure(Throwable t) {
                 // handle failure
              }
           });

      Specified by:
        `applyAsync` in interface `IAtomicLong`
      Parameters:
        `function` - the function
      Returns:
        an `ICompletableFuture` with the result of the function application

    - #### asyncApply

          public <R> InternalCompletableFuture<R> asyncApply(IFunction<Long,R> function)

      Description copied from interface: `AsyncAtomicLong`
      Applies a function on the value, the actual stored value will not change.
      Specified by:
        `asyncApply` in interface `AsyncAtomicLong`
      Parameters:
        `function` - the function
      Returns:
        the result of the function application

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AbstractDistributedObject<AtomicLongService>`

Copyright © 2019. All rights reserved.