com.hazelcast.client.proxy

## Class ClientAtomicLongProxy

- java.lang.Object
- - com.hazelcast.client.spi.ClientProxy
  - - com.hazelcast.client.proxy.ClientAtomicLongProxy

- All Implemented Interfaces:
    DistributedObject, IAtomicLong

      public class ClientAtomicLongProxy
      extends ClientProxy
      implements IAtomicLong

  Proxy implementation of `IAtomicLong`.

- - ### Field Summary

    - ### Fields inherited from class com.hazelcast.client.spi.ClientProxy

      `name`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientAtomicLongProxy(String serviceName, String objectId, ClientContext context)`

  - ### 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.
    `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.
    `long` | `incrementAndGet()` Atomically increments the current value by one.
    `InternalCompletableFuture<Long>` | `incrementAndGetAsync()` Atomically increments the current value by one.
    `protected com.hazelcast.client.impl.protocol.ClientMessage` | `invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage req)`
    `protected <T> T` | `invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, long invocationTimeoutSeconds)`
    `protected <T> ClientDelegatingFuture<T>` | `invokeOnPartitionAsync(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, com.hazelcast.client.impl.ClientMessageDecoder clientMessageDecoder)`
    `protected <T> T` | `invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage)`
    `protected <T> T` | `invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage, long invocationTimeoutSeconds)`
    `protected void` | `onInitialize()` Called when proxy is created.
    `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.client.spi.ClientProxy

      `deregisterListener, destroy, destroyLocally, destroyRemotely, equals, getClient, getConnectedServerVersion, getContext, getDistributedObjectName, getId, getName, getPartitionKey, getSerializationService, getServiceName, hashCode, invoke, invoke, invokeOnAddress, invokeOnPartition, invokeOnPartitionInterruptibly, onDestroy, onShutdown, postDestroy, preDestroy, registerListener, setContext, toData, toObject`

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

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

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

      `getName`

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

      `destroy, getPartitionKey, getServiceName`

- - ### Constructor Detail

    - #### ClientAtomicLongProxy

          public ClientAtomicLongProxy(String serviceName,
                                       String objectId,
                                       ClientContext context)

  - ### Method Detail

    - #### 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

    - #### 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

    - #### 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.

    - #### 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

    - #### 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

    - #### 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.

    - #### 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

    - #### get

          public long get()

      Description copied from interface: `IAtomicLong`
      Gets the current value.
      Specified by:
        `get` in interface `IAtomicLong`
      Returns:
        the current 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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<Long> future = atomicLong.addAndGetAsync(13);
               // do something else, then read the result
               Long result = future.get(); // this method will block until the result is available

               ICompletableFuture<Long> 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

    - #### 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.

    - #### 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.

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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` API consumers can use to track execution of this request

    - #### 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` API consumers can use to track execution of this request

    - #### 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.

    - #### 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

    - #### 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`. Example:

               class IsOneFunction implements IFunction<Long, Boolean> {
                 @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

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### onInitialize

          protected void onInitialize()

      Description copied from class: `ClientProxy`
      Called when proxy is created. Overriding implementations can add initialization specific logic into this method like registering a listener, creating a cleanup task etc.
      Overrides:
        `onInitialize` in class `ClientProxy`

    - #### invokeOnPartition

          protected com.hazelcast.client.impl.protocol.ClientMessage invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage req)

    - #### invokeOnPartitionInterruptibly

          protected <T> T invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage)
                                                  throws InterruptedException

      Throws:
        `InterruptedException`

    - #### invokeOnPartitionAsync

          protected <T> ClientDelegatingFuture<T> invokeOnPartitionAsync(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                                                         com.hazelcast.client.impl.ClientMessageDecoder clientMessageDecoder)

    - #### invokeOnPartition

          protected <T> T invokeOnPartition(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                            long invocationTimeoutSeconds)

    - #### invokeOnPartitionInterruptibly

          protected <T> T invokeOnPartitionInterruptibly(com.hazelcast.client.impl.protocol.ClientMessage clientMessage,
                                                         long invocationTimeoutSeconds)
                                                  throws InterruptedException

      Throws:
        `InterruptedException`

Copyright © 2018. All rights reserved.