public final class GridCacheAtomicReferenceImpl<T> extends Object implements GridCacheAtomicReferenceEx<T>, Externalizable
| Constructor and Description |
|---|
GridCacheAtomicReferenceImpl()
Empty constructor required by
Externalizable. |
GridCacheAtomicReferenceImpl(String name,
GridCacheInternalKey key,
GridCacheProjection<GridCacheInternalKey,GridCacheAtomicReferenceValue<T>> atomicView,
GridCacheContext ctx)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
compareAndSet(T expVal,
T newVal)
Conditionally sets the new value.
|
T |
get()
Gets current value of an atomic reference.
|
GridCacheInternalKey |
key()
Get current atomic reference key.
|
String |
name()
Name of atomic reference.
|
void |
onInvalid(Exception err) |
boolean |
onRemoved()
Set status of data structure as removed.
|
void |
readExternal(ObjectInput in) |
boolean |
removed()
Gets status of atomic.
|
void |
set(T val)
Unconditionally sets the value.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public GridCacheAtomicReferenceImpl()
Externalizable.public GridCacheAtomicReferenceImpl(String name, GridCacheInternalKey key, GridCacheProjection<GridCacheInternalKey,GridCacheAtomicReferenceValue<T>> atomicView, GridCacheContext ctx)
name - Atomic reference name.key - Atomic reference key.atomicView - Atomic projection.ctx - Cache context.public String name()
name in interface GridCacheAtomicReference<T>public T get() throws GridException
get in interface GridCacheAtomicReference<T>GridException - If operation failed.public void set(T val) throws GridException
set in interface GridCacheAtomicReference<T>val - Value.GridException - If operation failed.public boolean compareAndSet(T expVal, T newVal) throws GridException
expVal is equal
to current value respectively.compareAndSet in interface GridCacheAtomicReference<T>expVal - Expected value.newVal - New value.true than value have been updated.GridException - If operation failed.public boolean onRemoved()
onRemoved in interface GridCacheRemovablepublic void onInvalid(@Nullable Exception err)
onInvalid in interface GridCacheRemovableerr - Error which cause data structure to become invalid.public GridCacheInternalKey key()
key in interface GridCacheAtomicReferenceEx<T>public boolean removed()
removed in interface GridCacheAtomicReference<T>true if an atomic reference was removed from cache, false otherwise.public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionCopyright © 2014. All rights reserved.