org.apache.ignite

## Interface IgniteAtomicSequence

All Superinterfaces:
  AutoCloseable, Closeable

All Known Subinterfaces:
  GridCacheAtomicSequenceEx

All Known Implementing Classes:
  GridCacheAtomicSequenceImpl

    public interface IgniteAtomicSequence
    extends Closeable

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

# Functionality

Distributed atomic sequence includes the following main functionality:

- Method `get()` gets current value from atomic sequence.
- Various `get..(..)` methods get current value from atomic sequence and increase atomic sequences value.
- Various `add..(..)` `increment(..)` methods increase atomic sequences value and return increased value.
- Method `batchSize(int size)` sets batch size of current atomic sequence.
- Method `batchSize()` gets current batch size of atomic sequence.
- Method `name()` gets name of atomic sequence.

# Creating Distributed Atomic Sequence

Instance of distributed atomic sequence can be created by calling the following method:

- `Ignite.atomicSequence(String, long, boolean)`

See Also:
  `Ignite.atomicSequence(String, long, boolean)`

### Method Summary

Methods
`long` `addAndGet(long l)` Adds `l` elements to atomic sequence and gets value of atomic sequence.
`int` `batchSize()` Gets local batch size for this atomic sequence.
`void` `batchSize(int size)` Sets local batch size for atomic sequence.
`void` `close()` Removes this atomic sequence.
`long` `get()` Gets current value of atomic sequence.
`long` `getAndAdd(long l)` Gets current value of atomic sequence and adds `l` elements.
`long` `getAndIncrement()` Gets and increments current value of atomic sequence.
`long` `incrementAndGet()` Increments and returns the value of atomic sequence.
`String` `name()` Name of atomic sequence.
`boolean` `removed()` Gets status of atomic sequence.

### Method Detail

#### name

    String name()

Name of atomic sequence.

Returns:
  Name of atomic sequence.

#### get

    long get()
             throws IgniteException

Gets current value of atomic sequence.

Returns:
  Value of atomic sequence.
Throws:
  `IgniteException` - If operation failed.

#### incrementAndGet

    long incrementAndGet()
                         throws IgniteException

Increments and returns the value of atomic sequence.

Returns:
  Value of atomic sequence after increment.
Throws:
  `IgniteException` - If operation failed.

#### getAndIncrement

    long getAndIncrement()
                         throws IgniteException

Gets and increments current value of atomic sequence.

Returns:
  Value of atomic sequence before increment.
Throws:
  `IgniteException` - If operation failed.

#### addAndGet

    long addAndGet(long l)
                   throws IgniteException

Adds `l` elements to atomic sequence and gets value of atomic sequence.

Parameters:
  `l` - Number of added elements.
Returns:
  Value of atomic sequence.
Throws:
  `IgniteException` - If operation failed.

#### getAndAdd

    long getAndAdd(long l)
                   throws IgniteException

Gets current value of atomic sequence and adds `l` elements.

Parameters:
  `l` - Number of added elements.
Returns:
  Value of atomic sequence.
Throws:
  `IgniteException` - If operation failed.

#### batchSize

    int batchSize()

Gets local batch size for this atomic sequence.

Returns:
  Sequence batch size.

#### batchSize

    void batchSize(int size)

Sets local batch size for atomic sequence.

Parameters:
  `size` - Sequence batch size. Must be more then 0.

#### removed

    boolean removed()

Gets status of atomic sequence.

Returns:
  `true` if atomic sequence was removed from cache, `false` otherwise.

#### close

    void close()

Removes this atomic sequence.

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

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.2.0
Release Date | : September 15 2017