org.apache.ignite.internal.processors.datastructures

## Class GridCacheAtomicSequenceImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy<GridCacheAtomicSequenceValue>
  - - org.apache.ignite.internal.processors.datastructures.GridCacheAtomicSequenceImpl

All Implemented Interfaces:
  Closeable, Externalizable, Serializable, AutoCloseable, IgniteAtomicSequence, IgniteChangeGlobalStateSupport, GridCacheAtomicSequenceEx, GridCacheRemovable

    public final class GridCacheAtomicSequenceImpl
    extends AtomicDataStructureProxy<GridCacheAtomicSequenceValue>
    implements GridCacheAtomicSequenceEx, IgniteChangeGlobalStateSupport, Externalizable

Cache sequence implementation.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy

`cacheView, ctx, key, log, name, rmvd`

### Constructor Summary

Constructors
Constructor and Description
`GridCacheAtomicSequenceImpl()` Empty constructor required by `Externalizable`.
`GridCacheAtomicSequenceImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicSequenceValue> seqView, int batchSize, long locVal, long upBound)` Default constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`long` `addAndGet(long l)` Adds `l` elements to atomic sequence and gets value of atomic sequence.
`int` `batchSize()` Get local batch size for this sequences.
`void` `batchSize(int size)` Set local batch size for this sequences.
`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.
`protected void` `invalidateLocalState()` Invalidates local state.
`void` `readExternal(ObjectInput in)`
`String` `toString()`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy

`checkRemoved, checkRemovedAfterFail, key, name, needCheckNotRemoved, onActivate, onDeActivate, onRemoved, removed, restart, suspend`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.processors.datastructures.GridCacheAtomicSequenceEx

`key`

### Methods inherited from interface org.apache.ignite.internal.processors.datastructures.GridCacheRemovable

`needCheckNotRemoved, onRemoved, restart, suspend`

### Methods inherited from interface org.apache.ignite.IgniteAtomicSequence

`name, removed`

### Methods inherited from interface org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport

`onActivate, onDeActivate`

### Constructor Detail

#### GridCacheAtomicSequenceImpl

    public GridCacheAtomicSequenceImpl()

Empty constructor required by `Externalizable`.

#### GridCacheAtomicSequenceImpl

    public GridCacheAtomicSequenceImpl(String name,
                                       GridCacheInternalKey key,
                                       IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicSequenceValue> seqView,
                                       int batchSize,
                                       long locVal,
                                       long upBound)

Default constructor.

Parameters:
  `name` - Sequence name.
  `key` - Sequence key.
  `seqView` - Sequence projection.
  `batchSize` - Sequence batch size.
  `locVal` - Local counter.
  `upBound` - Upper bound.

### Method Detail

#### get

    public long get()

Gets current value of atomic sequence.

Specified by:
  `get` in interface `IgniteAtomicSequence`
Returns:
  Value of atomic sequence.

#### incrementAndGet

    public long incrementAndGet()

Increments and returns the value of atomic sequence.

Specified by:
  `incrementAndGet` in interface `IgniteAtomicSequence`
Returns:
  Value of atomic sequence after increment.

#### getAndIncrement

    public long getAndIncrement()

Gets and increments current value of atomic sequence.

Specified by:
  `getAndIncrement` in interface `IgniteAtomicSequence`
Returns:
  Value of atomic sequence before increment.

#### addAndGet

    public long addAndGet(long l)

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

Specified by:
  `addAndGet` in interface `IgniteAtomicSequence`
Parameters:
  `l` - Number of added elements.
Returns:
  Value of atomic sequence.

#### getAndAdd

    public long getAndAdd(long l)

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

Specified by:
  `getAndAdd` in interface `IgniteAtomicSequence`
Parameters:
  `l` - Number of added elements.
Returns:
  Value of atomic sequence.

#### batchSize

    public int batchSize()

Get local batch size for this sequences.

Specified by:
  `batchSize` in interface `IgniteAtomicSequence`
Returns:
  Sequence batch size.

#### batchSize

    public void batchSize(int size)

Set local batch size for this sequences.

Specified by:
  `batchSize` in interface `IgniteAtomicSequence`
Parameters:
  `size` - Sequence batch size. Must be more then 0.

#### invalidateLocalState

    protected void invalidateLocalState()

Invalidates local state.

Overrides:
  `invalidateLocalState` in class `AtomicDataStructureProxy<GridCacheAtomicSequenceValue>`

#### close

    public void close()

Removes this atomic sequence.

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `IgniteAtomicSequence`

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021