org.apache.ignite.internal.processors.datastructures

## Class GridCacheAtomicSequenceImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.datastructures.GridCacheAtomicSequenceImpl

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

    public final class GridCacheAtomicSequenceImpl
    extends Object
    implements GridCacheAtomicSequenceEx, Externalizable

Cache sequence implementation.

See Also:
  Serialized Form

### Constructor Summary

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

### Method Summary

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.
`GridCacheInternalKey` `key()` Get current sequence key.
`String` `name()` Name of atomic sequence.
`void` `onInvalid(Exception err)`
`boolean` `onRemoved()` Set status of data structure as removed.
`void` `readExternal(ObjectInput in)`
`boolean` `removed()` Gets status of atomic sequence.
`String` `toString()`
`void` `writeExternal(ObjectOutput out)`

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

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

### Constructor Detail

#### GridCacheAtomicSequenceImpl

    public GridCacheAtomicSequenceImpl()

Empty constructor required by `Externalizable`.

#### GridCacheAtomicSequenceImpl

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

Default constructor.

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

### Method Detail

#### name

    public String name()

Name of atomic sequence.

Specified by:
  `name` in interface `IgniteAtomicSequence`
Returns:
  Name of atomic sequence.

#### 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.

#### onRemoved

    public boolean onRemoved()

Set status of data structure as removed.

Specified by:
  `onRemoved` in interface `GridCacheRemovable`
Returns:
  Current status.

#### onInvalid

    public void onInvalid(@Nullable
                 Exception err)

Specified by:
  `onInvalid` in interface `GridCacheRemovable`
Parameters:
  `err` - Error which cause data structure to become invalid.

#### key

    public GridCacheInternalKey key()

Get current sequence key.

Specified by:
  `key` in interface `GridCacheAtomicSequenceEx`
Returns:
  Sequence key.

#### removed

    public boolean removed()

Gets status of atomic sequence.

Specified by:
  `removed` in interface `IgniteAtomicSequence`
Returns:
  `true` if atomic sequence was removed from cache, `false` otherwise.

#### 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`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015