com.hazelcast.client.proxy

## Class ClientAtomicReferenceProxy<E>

- java.lang.Object
- - com.hazelcast.client.spi.ClientProxy
  - - com.hazelcast.client.proxy.ClientAtomicReferenceProxy<E>

- Type Parameters:
    `E` - type of referenced object
  All Implemented Interfaces:
    DistributedObject, IAtomicReference<E>

      public class ClientAtomicReferenceProxy<E>
      extends ClientProxy
      implements IAtomicReference<E>

  Proxy implementation of `IAtomicReference`.

- - ### Field Summary

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

      `name`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `alter(IFunction<E,E> function)` Alters the currently stored reference by applying a function on it.
    `E` | `alterAndGet(IFunction<E,E> function)` Alters the currently stored reference by applying a function on it and gets the result.
    `InternalCompletableFuture<E>` | `alterAndGetAsync(IFunction<E,E> function)` Alters the currently stored reference by applying a function on it and gets the result.
    `InternalCompletableFuture<Void>` | `alterAsync(IFunction<E,E> function)` Alters the currently stored reference by applying a function on it.
    `<R> R` | `apply(IFunction<E,R> function)` Applies a function on the value, the actual stored value will not change.
    `<R> InternalCompletableFuture<R>` | `applyAsync(IFunction<E,R> function)` Applies a function on the value, the actual stored value will not change.
    `void` | `clear()` Clears the current stored reference.
    `InternalCompletableFuture<Void>` | `clearAsync()` Clears the current stored reference.
    `boolean` | `compareAndSet(E expect, E update)` Atomically sets the value to the given updated value only if the current value `==` the expected value.
    `InternalCompletableFuture<Boolean>` | `compareAndSetAsync(E expect, E update)` Atomically sets the value to the given updated value only if the current value `==` the expected value.
    `boolean` | `contains(E expected)` Checks if the reference contains the value.
    `InternalCompletableFuture<Boolean>` | `containsAsync(E expected)` Checks if the reference contains the value.
    `E` | `get()` Gets the current value.
    `E` | `getAndAlter(IFunction<E,E> function)` Alters the currently stored reference by applying a function on it on and gets the old value.
    `InternalCompletableFuture<E>` | `getAndAlterAsync(IFunction<E,E> function)` Alters the currently stored reference by applying a function on it on and gets the old value.
    `E` | `getAndSet(E newValue)` Gets the old value and sets the new value.
    `InternalCompletableFuture<E>` | `getAndSetAsync(E newValue)` Gets the value and sets the new value.
    `InternalCompletableFuture<E>` | `getAsync()` Gets the current value.
    `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.clientside.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)`
    `boolean` | `isNull()` Checks if the stored reference is `null`.
    `InternalCompletableFuture<Boolean>` | `isNullAsync()` Checks if the stored reference is `null`.
    `protected void` | `onInitialize()` Called when proxy is created.
    `void` | `set(E newValue)` Atomically sets the given value.
    `E` | `setAndGet(E update)` Sets and gets the value.
    `InternalCompletableFuture<Void>` | `setAsync(E 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.DistributedObject

      `destroy, getName, getPartitionKey, getServiceName`

- - ### Constructor Detail

    - #### ClientAtomicReferenceProxy

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

  - ### Method Detail

    - #### applyAsync

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

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

    - #### apply

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

      Description copied from interface: `IAtomicReference`
      Applies a function on the value, the actual stored value will not change.
      Specified by:
        `apply` in interface `IAtomicReference<E>`
      Parameters:
        `function` - the function applied on the value, the stored value does not change
      Returns:
        the result of the function application

    - #### alterAsync

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

      Description copied from interface: `IAtomicReference`
      Alters the currently stored reference by applying a function on it.
      Specified by:
        `alterAsync` in interface `IAtomicReference<E>`
      Parameters:
        `function` - the function

    - #### alter

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

      Description copied from interface: `IAtomicReference`
      Alters the currently stored reference by applying a function on it.
      Specified by:
        `alter` in interface `IAtomicReference<E>`
      Parameters:
        `function` - the function that alters the currently stored reference

    - #### alterAndGetAsync

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

      Description copied from interface: `IAtomicReference`
      Alters the currently stored reference by applying a function on it and gets the result.
      Specified by:
        `alterAndGetAsync` in interface `IAtomicReference<E>`
      Parameters:
        `function` - the function
      Returns:
        the new value

    - #### alterAndGet

          public E alterAndGet(IFunction<E,E> function)

      Description copied from interface: `IAtomicReference`
      Alters the currently stored reference by applying a function on it and gets the result.
      Specified by:
        `alterAndGet` in interface `IAtomicReference<E>`
      Parameters:
        `function` - the function that alters the currently stored reference
      Returns:
        the new value, the result of the applied function

    - #### getAndAlterAsync

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

      Description copied from interface: `IAtomicReference`
      Alters the currently stored reference by applying a function on it on and gets the old value.
      Specified by:
        `getAndAlterAsync` in interface `IAtomicReference<E>`
      Parameters:
        `function` - the function
      Returns:
        the old value

    - #### getAndAlter

          public E getAndAlter(IFunction<E,E> function)

      Description copied from interface: `IAtomicReference`
      Alters the currently stored reference by applying a function on it on and gets the old value.
      Specified by:
        `getAndAlter` in interface `IAtomicReference<E>`
      Parameters:
        `function` - the function that alters the currently stored reference
      Returns:
        the old value, the value before the function is applied

    - #### compareAndSetAsync

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

      Description copied from interface: `IAtomicReference`
      Atomically sets the value to the given updated value only if the current value `==` the expected value.
      Specified by:
        `compareAndSetAsync` in interface `IAtomicReference<E>`
      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

    - #### compareAndSet

          public boolean compareAndSet(E expect,
                                       E update)

      Description copied from interface: `IAtomicReference`
      Atomically sets the value to the given updated value only if the current value `==` the expected value.
      Specified by:
        `compareAndSet` in interface `IAtomicReference<E>`
      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

    - #### containsAsync

          public InternalCompletableFuture<Boolean> containsAsync(E expected)

      Description copied from interface: `IAtomicReference`
      Checks if the reference contains the value.
      Specified by:
        `containsAsync` in interface `IAtomicReference<E>`
      Parameters:
        `expected` - the value to check (is allowed to be null)
      Returns:
        `true` if the value is found, `false` otherwise

    - #### contains

          public boolean contains(E expected)

      Description copied from interface: `IAtomicReference`
      Checks if the reference contains the value.
      Specified by:
        `contains` in interface `IAtomicReference<E>`
      Parameters:
        `expected` - the value to check (is allowed to be `null`)
      Returns:
        `true` if the value is found, `false` otherwise

    - #### getAsync

          public InternalCompletableFuture<E> getAsync()

      Description copied from interface: `IAtomicReference`
      Gets the current value.
      Specified by:
        `getAsync` in interface `IAtomicReference<E>`
      Returns:
        the current value

    - #### get

          public E get()

      Description copied from interface: `IAtomicReference`
      Gets the current value.
      Specified by:
        `get` in interface `IAtomicReference<E>`
      Returns:
        the current value

    - #### setAsync

          public InternalCompletableFuture<Void> setAsync(E newValue)

      Description copied from interface: `IAtomicReference`
      Atomically sets the given value.
      Specified by:
        `setAsync` in interface `IAtomicReference<E>`
      Parameters:
        `newValue` - the new value

    - #### set

          public void set(E newValue)

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

    - #### clearAsync

          public InternalCompletableFuture<Void> clearAsync()

      Description copied from interface: `IAtomicReference`
      Clears the current stored reference.
      Specified by:
        `clearAsync` in interface `IAtomicReference<E>`

    - #### clear

          public void clear()

      Description copied from interface: `IAtomicReference`
      Clears the current stored reference.
      Specified by:
        `clear` in interface `IAtomicReference<E>`

    - #### getAndSetAsync

          public InternalCompletableFuture<E> getAndSetAsync(E newValue)

      Description copied from interface: `IAtomicReference`
      Gets the value and sets the new value.
      Specified by:
        `getAndSetAsync` in interface `IAtomicReference<E>`
      Parameters:
        `newValue` - the new value
      Returns:
        the old value

    - #### getAndSet

          public E getAndSet(E newValue)

      Description copied from interface: `IAtomicReference`
      Gets the old value and sets the new value.
      Specified by:
        `getAndSet` in interface `IAtomicReference<E>`
      Parameters:
        `newValue` - the new value
      Returns:
        the old value

    - #### setAndGet

          public E setAndGet(E update)

      Description copied from interface: `IAtomicReference`
      Sets and gets the value.
      Specified by:
        `setAndGet` in interface `IAtomicReference<E>`
      Parameters:
        `update` - the new value
      Returns:
        the new value

    - #### isNullAsync

          public InternalCompletableFuture<Boolean> isNullAsync()

      Description copied from interface: `IAtomicReference`
      Checks if the stored reference is `null`.
      Specified by:
        `isNullAsync` in interface `IAtomicReference<E>`
      Returns:
        `true` if `null`, `false` otherwise

    - #### isNull

          public boolean isNull()

      Description copied from interface: `IAtomicReference`
      Checks if the stored reference is `null`.
      Specified by:
        `isNull` in interface `IAtomicReference<E>`
      Returns:
        `true` if `null`, `false` otherwise

    - #### 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.clientside.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 © 2020. All rights reserved.