Package org.apache.ignite

## Interface IgniteAtomicStamped<T,​S>

- All Superinterfaces:
    `AutoCloseable`, `Closeable`

      public interface IgniteAtomicStamped<T,​S>
      extends Closeable

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

  # Functionality

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

  # Creating Distributed Atomic Stamped

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

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` | Removes this atomic stamped.
    `boolean` | `compareAndSet​(T expVal, T newVal, S expStamp, S newStamp)` | Conditionally sets the new value and new stamp.
    `IgniteBiTuple<T,​S>` | `get()` | Gets both current value and current stamp of atomic stamped.
    `String` | `name()` | Name of atomic stamped.
    `boolean` | `removed()` | Gets status of atomic.
    `void` | `set​(T val, S stamp)` | Unconditionally sets the value and the stamp.
    `S` | `stamp()` | Gets current stamp.
    `T` | `value()` | Gets current value.

- - ### Method Detail

    - #### name

          String name()

      Name of atomic stamped.
      Returns:
        Name of atomic stamped.

    - #### get

          IgniteBiTuple<T,​S> get()
                                throws IgniteException

      Gets both current value and current stamp of atomic stamped.
      Returns:
        both current value and current stamp of atomic stamped.
      Throws:
        `IgniteException` - If operation failed.

    - #### set

          void set​(T val,
                   S stamp)
            throws IgniteException

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

    - #### compareAndSet

          boolean compareAndSet​(T expVal,
                                T newVal,
                                S expStamp,
                                S newStamp)
                         throws IgniteException

      Conditionally sets the new value and new stamp. They will be set if `expVal` and `expStamp` are equal to current value and current stamp respectively.
      Parameters:
        `expVal` - Expected value.
        `newVal` - New value.
        `expStamp` - Expected stamp.
        `newStamp` - New stamp.
      Returns:
        Result of operation execution. If `true` than value and stamp will be updated.
      Throws:
        `IgniteException` - If operation failed.

    - #### stamp

          S stamp()
           throws IgniteException

      Gets current stamp.
      Returns:
        Current stamp.
      Throws:
        `IgniteException` - If operation failed.

    - #### value

          T value()
           throws IgniteException

      Gets current value.
      Returns:
        Current value.
      Throws:
        `IgniteException` - If operation failed.

    - #### removed

          boolean removed()

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

    - #### close

          void close()

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