org.apache.ignite

## Interface IgniteAtomicReference<T>

- All Superinterfaces:
    AutoCloseable, Closeable

      public interface IgniteAtomicReference<T>
      extends Closeable

  This interface provides a rich API for working with distributed atomic reference.

  # Functionality

  Distributed atomic reference includes the following main functionality:
  - Method `get()` gets current value of an atomic reference.
  - Method `set(Object)` unconditionally sets the value in the an atomic reference.
  - Methods `compareAndSet(...)` conditionally set the value in the an atomic reference.
  - Method `name()` gets name of atomic reference.

  # Creating Distributed Atomic Reference

  Instance of distributed atomic reference can be created by calling the following method:
  - `Ignite.atomicReference(String, Object, boolean)`
  See Also:
    `Ignite.atomicReference(String, Object, boolean)`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Removes this atomic reference.
    `boolean` | `compareAndSet(T expVal, T newVal)` Conditionally sets the new value.
    `T` | `get()` Gets current value of an atomic reference.
    `String` | `name()` Name of atomic reference.
    `boolean` | `removed()` Gets status of atomic.
    `void` | `set(T val)` Unconditionally sets the value.

- - ### Method Detail

    - #### name

          String name()

      Name of atomic reference.
      Returns:
        Name of an atomic reference.

    - #### get

          T get()
          throws IgniteException

      Gets current value of an atomic reference.
      Returns:
        current value of an atomic reference.
      Throws:
        `IgniteException` - If operation failed.

    - #### set

          void set(T val)
            throws IgniteException

      Unconditionally sets the value.
      Parameters:
        `val` - Value.
      Throws:
        `IgniteException` - If operation failed.

    - #### compareAndSet

          boolean compareAndSet(T expVal,
                                T newVal)
                         throws IgniteException

      Conditionally sets the new value. That will be set if `expVal` is equal to current value respectively.
      Parameters:
        `expVal` - Expected value.
        `newVal` - New value.
      Returns:
        Result of operation execution. If `true` than value have been updated.
      Throws:
        `IgniteException` - If operation failed.

    - #### removed

          boolean removed()

      Gets status of atomic.
      Returns:
        `true` if an atomic reference was removed from cache, `false` otherwise.

    - #### close

          void close()

      Removes this atomic reference.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `Closeable`
      Throws:
        `IgniteException` - If operation failed.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022