org.apache.ignite.internal.processors.datastructures

## Class GridCacheAtomicStampedImpl<T,S>

- java.lang.Object
- - org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy<GridCacheAtomicStampedValue<T,S>>
  - - 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 AtomicDataStructureProxy<GridCacheAtomicStampedValue<T,S>>
    implements GridCacheAtomicStampedEx<T,S>, IgniteChangeGlobalStateSupport, Externalizable

Cache atomic stamped 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
`GridCacheAtomicStampedImpl()` Empty constructor required by `Externalizable`.
`GridCacheAtomicStampedImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicStampedValue<T,S>> atomicView)` Default constructor.

### Method Summary

All Methods Instance Methods Concrete 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.
`void` `readExternal(ObjectInput in)`
`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 org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy

`checkRemoved, checkRemovedAfterFail, invalidateLocalState, 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.GridCacheAtomicStampedEx

`key`

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

`needCheckNotRemoved, onRemoved, restart, suspend`

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

`name, removed`

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

`onActivate, onDeActivate`

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

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

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

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021