org.apache.ignite

## Interface IgniteAtomicLong

- All Superinterfaces:
    AutoCloseable, Closeable

      public interface IgniteAtomicLong
      extends Closeable

  This interface provides a rich API for working with distributedly cached atomic long value.

  # Functionality

  Distributed atomic long includes the following main functionality:
  - Method `get()` gets current value of atomic long.
  - Various `get..(..)` methods get current value of atomic long and increase or decrease value of atomic long.
  - Method `addAndGet(long l)` sums `l` with current value of atomic long and returns result.
  - Method `incrementAndGet()` increases value of atomic long and returns result.
  - Method `decrementAndGet()` decreases value of atomic long and returns result.
  - Method `getAndSet(long l)` gets current value of atomic long and sets `l` as value of atomic long.
  - Method `name()` gets name of atomic long.

  # Creating Distributed Atomic Long

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

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `addAndGet(long l)` Adds `l` and gets current value of atomic long.
    `void` | `close()` Removes this atomic long.
    `boolean` | `compareAndSet(long expVal, long newVal)` Atomically compares current value to the expected value, and if they are equal, sets current value to new value.
    `long` | `decrementAndGet()` Decrements and gets current value of atomic long.
    `long` | `get()` Gets current value of atomic long.
    `long` | `getAndAdd(long l)` Gets current value of atomic long and adds `l`.
    `long` | `getAndDecrement()` Gets and decrements current value of atomic long.
    `long` | `getAndIncrement()` Gets and increments current value of atomic long.
    `long` | `getAndSet(long l)` Gets current value of atomic long and sets new value `l` of atomic long.
    `long` | `incrementAndGet()` Increments and gets current value of atomic long.
    `String` | `name()` Name of atomic long.
    `boolean` | `removed()` Gets status of atomic.

- - ### Method Detail

    - #### name

          String name()

      Name of atomic long.
      Returns:
        Name of atomic long.

    - #### get

          long get()
            throws IgniteException

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

    - #### incrementAndGet

          long incrementAndGet()
                        throws IgniteException

      Increments and gets current value of atomic long.
      Returns:
        Value.
      Throws:
        `IgniteException` - If operation failed.

    - #### getAndIncrement

          long getAndIncrement()
                        throws IgniteException

      Gets and increments current value of atomic long.
      Returns:
        Value.
      Throws:
        `IgniteException` - If operation failed.

    - #### addAndGet

          long addAndGet(long l)
                  throws IgniteException

      Adds `l` and gets current value of atomic long.
      Parameters:
        `l` - Number which will be added.
      Returns:
        Value.
      Throws:
        `IgniteException` - If operation failed.

    - #### getAndAdd

          long getAndAdd(long l)
                  throws IgniteException

      Gets current value of atomic long and adds `l`.
      Parameters:
        `l` - Number which will be added.
      Returns:
        Value.
      Throws:
        `IgniteException` - If operation failed.

    - #### decrementAndGet

          long decrementAndGet()
                        throws IgniteException

      Decrements and gets current value of atomic long.
      Returns:
        Value.
      Throws:
        `IgniteException` - If operation failed.

    - #### getAndDecrement

          long getAndDecrement()
                        throws IgniteException

      Gets and decrements current value of atomic long.
      Returns:
        Value.
      Throws:
        `IgniteException` - If operation failed.

    - #### getAndSet

          long getAndSet(long l)
                  throws IgniteException

      Gets current value of atomic long and sets new value `l` of atomic long.
      Parameters:
        `l` - New value of atomic long.
      Returns:
        Value.
      Throws:
        `IgniteException` - If operation failed.

    - #### compareAndSet

          boolean compareAndSet(long expVal,
                                long newVal)
                         throws IgniteException

      Atomically compares current value to the expected value, and if they are equal, sets current value to new value.
      Parameters:
        `expVal` - Expected atomic long's value.
        `newVal` - New atomic long's value to set if current value equal to expected value.
      Returns:
        `True` if comparison succeeded, `false` otherwise.
      Throws:
        `IgniteException` - If failed.

    - #### removed

          boolean removed()

      Gets status of atomic.
      Returns:
        `true` if atomic was removed from cache, `false` in other case.

    - #### close

          void close()

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

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023