Class GridCacheAtomicLongImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy<GridCacheAtomicLongValue>
-
- org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl
-
- All Implemented Interfaces:
Closeable,Externalizable,Serializable,AutoCloseable,IgniteAtomicLong,IgniteChangeGlobalStateSupport,GridCacheAtomicLongEx,GridCacheRemovable
public final class GridCacheAtomicLongImpl extends AtomicDataStructureProxy<GridCacheAtomicLongValue> implements GridCacheAtomicLongEx, IgniteChangeGlobalStateSupport, Externalizable
Cache atomic long implementation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GridCacheAtomicLongImpl()Empty constructor required byExternalizable.GridCacheAtomicLongImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicLongValue> atomicView)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longaddAndGet(long l)Addsland gets current value of atomic long.voidclose()Removes this atomic long.booleancompareAndSet(long expVal, long newVal)Atomically compares current value to the expected value, and if they are equal, sets current value to new value.longcompareAndSetAndGet(long expVal, long newVal)longdecrementAndGet()Decrements and gets current value of atomic long.longget()Gets current value of atomic long.longgetAndAdd(long l)Gets current value of atomic long and addsl.longgetAndDecrement()Gets and decrements current value of atomic long.longgetAndIncrement()Gets and increments current value of atomic long.longgetAndSet(long l)Gets current value of atomic long and sets new valuelof atomic long.longincrementAndGet()Increments and gets current value of atomic long.voidreadExternal(ObjectInput in)StringtoString()voidwriteExternal(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.GridCacheAtomicLongEx
key
-
Methods inherited from interface org.apache.ignite.internal.processors.datastructures.GridCacheRemovable
needCheckNotRemoved, onRemoved, restart, suspend
-
Methods inherited from interface org.apache.ignite.IgniteAtomicLong
name, removed
-
Methods inherited from interface org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport
onActivate, onDeActivate
-
-
-
-
Constructor Detail
-
GridCacheAtomicLongImpl
public GridCacheAtomicLongImpl()
Empty constructor required byExternalizable.
-
GridCacheAtomicLongImpl
public GridCacheAtomicLongImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicLongValue> atomicView)
Default constructor.- Parameters:
name- Atomic long name.key- Atomic long key.atomicView- Atomic projection.
-
-
Method Detail
-
get
public long get()
Gets current value of atomic long.- Specified by:
getin interfaceIgniteAtomicLong- Returns:
- Current value of atomic long.
-
incrementAndGet
public long incrementAndGet()
Increments and gets current value of atomic long.- Specified by:
incrementAndGetin interfaceIgniteAtomicLong- Returns:
- Value.
-
getAndIncrement
public long getAndIncrement()
Gets and increments current value of atomic long.- Specified by:
getAndIncrementin interfaceIgniteAtomicLong- Returns:
- Value.
-
addAndGet
public long addAndGet(long l)
Addsland gets current value of atomic long.- Specified by:
addAndGetin interfaceIgniteAtomicLong- Parameters:
l- Number which will be added.- Returns:
- Value.
-
getAndAdd
public long getAndAdd(long l)
Gets current value of atomic long and addsl.- Specified by:
getAndAddin interfaceIgniteAtomicLong- Parameters:
l- Number which will be added.- Returns:
- Value.
-
decrementAndGet
public long decrementAndGet()
Decrements and gets current value of atomic long.- Specified by:
decrementAndGetin interfaceIgniteAtomicLong- Returns:
- Value.
-
getAndDecrement
public long getAndDecrement()
Gets and decrements current value of atomic long.- Specified by:
getAndDecrementin interfaceIgniteAtomicLong- Returns:
- Value.
-
getAndSet
public long getAndSet(long l)
Gets current value of atomic long and sets new valuelof atomic long.- Specified by:
getAndSetin interfaceIgniteAtomicLong- Parameters:
l- New value of atomic long.- Returns:
- Value.
-
compareAndSet
public 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.- Specified by:
compareAndSetin interfaceIgniteAtomicLong- Parameters:
expVal- Expected atomic long's value.newVal- New atomic long's value to set if current value equal to expected value.- Returns:
Trueif comparison succeeded,falseotherwise.
-
compareAndSetAndGet
public long compareAndSetAndGet(long expVal, long newVal)- Parameters:
expVal- Expected value.newVal- New value.- Returns:
- Old value.
-
close
public void close()
Removes this atomic long.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIgniteAtomicLong
-
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
-
-