Class GridCacheAtomicReferenceImpl<T>
- java.lang.Object
-
- org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy<GridCacheAtomicReferenceValue<T>>
-
- org.apache.ignite.internal.processors.datastructures.GridCacheAtomicReferenceImpl<T>
-
- All Implemented Interfaces:
Closeable,Externalizable,Serializable,AutoCloseable,IgniteAtomicReference<T>,IgniteChangeGlobalStateSupport,GridCacheAtomicReferenceEx<T>,GridCacheRemovable
public final class GridCacheAtomicReferenceImpl<T> extends AtomicDataStructureProxy<GridCacheAtomicReferenceValue<T>> implements GridCacheAtomicReferenceEx<T>, IgniteChangeGlobalStateSupport, Externalizable
Cache atomic reference implementation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GridCacheAtomicReferenceImpl()Empty constructor required byExternalizable.GridCacheAtomicReferenceImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicReferenceValue<T>> atomicView)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Removes this atomic reference.booleancompareAndSet(T expVal, T newVal)Conditionally sets the new value.TcompareAndSetAndGet(T newVal, T expVal)Compares current value with specified value for equality and, if they are equal, replaces current value.Tget()Gets current value of an atomic reference.Stringname()Name of atomic reference.voidreadExternal(ObjectInput in)voidset(T val)Unconditionally sets the value.StringtoString()voidwriteExternal(ObjectOutput out)-
Methods inherited from class org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy
checkRemoved, checkRemovedAfterFail, invalidateLocalState, key, 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.GridCacheAtomicReferenceEx
key
-
Methods inherited from interface org.apache.ignite.internal.processors.datastructures.GridCacheRemovable
needCheckNotRemoved, onRemoved, restart, suspend
-
Methods inherited from interface org.apache.ignite.IgniteAtomicReference
removed
-
Methods inherited from interface org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport
onActivate, onDeActivate
-
-
-
-
Constructor Detail
-
GridCacheAtomicReferenceImpl
public GridCacheAtomicReferenceImpl()
Empty constructor required byExternalizable.
-
GridCacheAtomicReferenceImpl
public GridCacheAtomicReferenceImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicReferenceValue<T>> atomicView)
Default constructor.- Parameters:
name- Atomic reference name.key- Atomic reference key.atomicView- Atomic projection.
-
-
Method Detail
-
name
public String name()
Name of atomic reference.- Specified by:
namein interfaceIgniteAtomicReference<T>- Overrides:
namein classAtomicDataStructureProxy<GridCacheAtomicReferenceValue<T>>- Returns:
- Datastructure name.
-
get
public T get()
Gets current value of an atomic reference.- Specified by:
getin interfaceIgniteAtomicReference<T>- Returns:
- current value of an atomic reference.
-
set
public void set(T val)
Unconditionally sets the value.- Specified by:
setin interfaceIgniteAtomicReference<T>- Parameters:
val- Value.
-
compareAndSet
public boolean compareAndSet(T expVal, T newVal)
Conditionally sets the new value. That will be set ifexpValis equal to current value respectively.- Specified by:
compareAndSetin interfaceIgniteAtomicReference<T>- Parameters:
expVal- Expected value.newVal- New value.- Returns:
- Result of operation execution. If
truethan value have been updated.
-
compareAndSetAndGet
public T compareAndSetAndGet(T newVal, T expVal)
Compares current value with specified value for equality and, if they are equal, replaces current value.- Parameters:
newVal- New value to set.expVal- Expected value.- Returns:
- Original value.
-
close
public void close()
Removes this atomic reference.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIgniteAtomicReference<T>
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
-