public final class GridCacheAtomicLongImpl extends Object implements GridCacheAtomicLongEx, Externalizable
| Constructor and Description |
|---|
GridCacheAtomicLongImpl()
Empty constructor required by
Externalizable. |
GridCacheAtomicLongImpl(String name,
GridCacheInternalKey key,
GridCacheProjection<GridCacheInternalKey,GridCacheAtomicLongValue> atomicView,
GridCacheContext ctx)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
long |
addAndGet(long l)
Adds
l and gets current value of atomic long. |
boolean |
compareAndSet(long expVal,
long newVal)
Atomically compares current value to the expected value, and if they are equal, sets current value
to new value.
|
long |
decrementAndGet()
Decrements and gets current value of atomic long.
|
long |
get()
Gets current value of atomic long.
|
long |
getAndAdd(long l)
Gets current value of atomic long and adds
l. |
long |
getAndDecrement()
Gets and decrements current value of atomic long.
|
long |
getAndIncrement()
Gets and increments current value of atomic long.
|
long |
getAndSet(long l)
Gets current value of atomic long and sets new value
l of atomic long. |
long |
incrementAndGet()
Increments and gets current value of atomic long.
|
GridCacheInternalKey |
key()
Get current atomic long key.
|
String |
name()
Name of atomic long.
|
void |
onInvalid(Exception err) |
boolean |
onRemoved()
Set status of data structure as removed.
|
void |
readExternal(ObjectInput in) |
boolean |
removed()
Gets status of atomic.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public GridCacheAtomicLongImpl()
Externalizable.public GridCacheAtomicLongImpl(String name, GridCacheInternalKey key, GridCacheProjection<GridCacheInternalKey,GridCacheAtomicLongValue> atomicView, GridCacheContext ctx)
name - Atomic long name.key - Atomic long key.atomicView - Atomic projection.ctx - CacheContext.public String name()
name in interface GridCacheAtomicLongpublic long get()
throws GridException
get in interface GridCacheAtomicLongGridException - If operation failed.public long incrementAndGet()
throws GridException
incrementAndGet in interface GridCacheAtomicLongGridException - If operation failed.public long getAndIncrement()
throws GridException
getAndIncrement in interface GridCacheAtomicLongGridException - If operation failed.public long addAndGet(long l)
throws GridException
l and gets current value of atomic long.addAndGet in interface GridCacheAtomicLongl - Number which will be added.GridException - If operation failed.public long getAndAdd(long l)
throws GridException
l.getAndAdd in interface GridCacheAtomicLongl - Number which will be added.GridException - If operation failed.public long decrementAndGet()
throws GridException
decrementAndGet in interface GridCacheAtomicLongGridException - If operation failed.public long getAndDecrement()
throws GridException
getAndDecrement in interface GridCacheAtomicLongGridException - If operation failed.public long getAndSet(long l)
throws GridException
l of atomic long.getAndSet in interface GridCacheAtomicLongl - New value of atomic long.GridException - If operation failed.public boolean compareAndSet(long expVal,
long newVal)
throws GridException
compareAndSet in interface GridCacheAtomicLongexpVal - Expected atomic long's value.newVal - New atomic long's value to set if current value equal to expected value.True if comparison succeeded, false otherwise.GridException - If 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 GridCacheAtomicLongExpublic boolean removed()
removed in interface GridCacheAtomicLongtrue if atomic was removed from cache, false in other case.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.