org.apache.ignite.internal.processors.datastructures

## Class GridCacheAtomicStampedImpl<T,S>

- java.lang.Object
- - org.apache.ignite.internal.processors.datastructures.GridCacheAtomicStampedImpl<T,S>

All Implemented Interfaces:
  Closeable, Externalizable, Serializable, AutoCloseable, IgniteAtomicStamped<T,S>, IgniteChangeGlobalStateSupport, GridCacheAtomicStampedEx<T,S>, GridCacheRemovable

    public final class GridCacheAtomicStampedImpl<T,S>
    extends Object
    implements GridCacheAtomicStampedEx<T,S>, IgniteChangeGlobalStateSupport, Externalizable

Cache atomic stamped implementation.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`GridCacheAtomicStampedImpl()` Empty constructor required by `Externalizable`.
`GridCacheAtomicStampedImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicStampedValue<T,S>> atomicView)` Default constructor.

### Method Summary

Methods
`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.
`GridCacheInternalKey` `key()` Get current atomic stamped key.
`String` `name()` Name of atomic stamped.
`void` `needCheckNotRemoved()`
`void` `onActivate(GridKernalContext kctx)` Called when cluster performing activation.
`void` `onDeActivate(GridKernalContext kctx)` Called when cluster performing deactivation.
`boolean` `onRemoved()` Set status of data structure as removed.
`void` `readExternal(ObjectInput in)`
`boolean` `removed()` Gets status of atomic.
`void` `set(T val, S stamp)` Unconditionally sets the value and the stamp.
`S` `stamp()` Gets current stamp.
`String` `toString()`
`T` `value()` Gets current value.
`void` `writeExternal(ObjectOutput out)`

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

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

### Constructor Detail

#### GridCacheAtomicStampedImpl

    public GridCacheAtomicStampedImpl()

Empty constructor required by `Externalizable`.

#### GridCacheAtomicStampedImpl

    public GridCacheAtomicStampedImpl(String name,
                              GridCacheInternalKey key,
                              IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicStampedValue<T,S>> atomicView)

Default constructor.

Parameters:
  `name` - Atomic stamped name.
  `key` - Atomic stamped key.
  `atomicView` - Atomic projection.

### Method Detail

#### name

    public String name()

Name of atomic stamped.

Specified by:
  `name` in interface `IgniteAtomicStamped<T,S>`
Returns:
  Name of atomic stamped.

#### get

    public IgniteBiTuple<T,S> get()

Gets both current value and current stamp of atomic stamped.

Specified by:
  `get` in interface `IgniteAtomicStamped<T,S>`
Returns:
  both current value and current stamp of atomic stamped.

#### set

    public void set(T val,
           S stamp)

Unconditionally sets the value and the stamp.

Specified by:
  `set` in interface `IgniteAtomicStamped<T,S>`
Parameters:
  `val` - Value.
  `stamp` - Stamp.

#### compareAndSet

    public boolean compareAndSet(T expVal,
                        T newVal,
                        S expStamp,
                        S newStamp)

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.

Specified by:
  `compareAndSet` in interface `IgniteAtomicStamped<T,S>`
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.

#### stamp

    public S stamp()

Gets current stamp.

Specified by:
  `stamp` in interface `IgniteAtomicStamped<T,S>`
Returns:
  Current stamp.

#### value

    public T value()

Gets current value.

Specified by:
  `value` in interface `IgniteAtomicStamped<T,S>`
Returns:
  Current value.

#### onRemoved

    public boolean onRemoved()

Set status of data structure as removed.

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

#### needCheckNotRemoved

    public void needCheckNotRemoved()

Specified by:
  `needCheckNotRemoved` in interface `GridCacheRemovable`

#### key

    public GridCacheInternalKey key()

Get current atomic stamped key.

Specified by:
  `key` in interface `GridCacheAtomicStampedEx<T,S>`
Returns:
  Atomic stamped key.

#### removed

    public boolean removed()

Gets status of atomic.

Specified by:
  `removed` in interface `IgniteAtomicStamped<T,S>`
Returns:
  `true` if atomic stamped was removed from cache, `false` otherwise.

#### close

    public void close()

Removes this atomic stamped.

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `IgniteAtomicStamped<T,S>`

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

#### onActivate

    public void onActivate(GridKernalContext kctx)
                    throws IgniteCheckedException

Called when cluster performing activation.

Specified by:
  `onActivate` in interface `IgniteChangeGlobalStateSupport`
Parameters:
  `kctx` - Kernal context.
Throws:
  `IgniteCheckedException` - If failed.

#### onDeActivate

    public void onDeActivate(GridKernalContext kctx)

Called when cluster performing deactivation.

Specified by:
  `onDeActivate` in interface `IgniteChangeGlobalStateSupport`
Parameters:
  `kctx` - Kernal context.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

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