Class GridCacheAtomicSequenceImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy<GridCacheAtomicSequenceValue>
-
- org.apache.ignite.internal.processors.datastructures.GridCacheAtomicSequenceImpl
-
- All Implemented Interfaces:
Closeable,Externalizable,Serializable,AutoCloseable,IgniteAtomicSequence,IgniteChangeGlobalStateSupport,GridCacheAtomicSequenceEx,GridCacheRemovable
public final class GridCacheAtomicSequenceImpl extends AtomicDataStructureProxy<GridCacheAtomicSequenceValue> implements GridCacheAtomicSequenceEx, IgniteChangeGlobalStateSupport, Externalizable
Cache sequence implementation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GridCacheAtomicSequenceImpl()Empty constructor required byExternalizable.GridCacheAtomicSequenceImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicSequenceValue> seqView, int batchSize, long locVal, long upBound)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longaddAndGet(long l)Addslelements to atomic sequence and gets value of atomic sequence.intbatchSize()Get local batch size for this sequences.voidbatchSize(int size)Set local batch size for this sequences.voidclose()Removes this atomic sequence.longget()Gets current value of atomic sequence.longgetAndAdd(long l)Gets current value of atomic sequence and addslelements.longgetAndIncrement()Gets and increments current value of atomic sequence.longincrementAndGet()Increments and returns the value of atomic sequence.protected voidinvalidateLocalState()Invalidates local state.voidreadExternal(ObjectInput in)StringtoString()voidwriteExternal(ObjectOutput out)-
Methods inherited from class org.apache.ignite.internal.processors.datastructures.AtomicDataStructureProxy
checkRemoved, checkRemovedAfterFail, 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.GridCacheAtomicSequenceEx
key
-
Methods inherited from interface org.apache.ignite.internal.processors.datastructures.GridCacheRemovable
needCheckNotRemoved, onRemoved, restart, suspend
-
Methods inherited from interface org.apache.ignite.IgniteAtomicSequence
name, removed
-
Methods inherited from interface org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport
onActivate, onDeActivate
-
-
-
-
Constructor Detail
-
GridCacheAtomicSequenceImpl
public GridCacheAtomicSequenceImpl()
Empty constructor required byExternalizable.
-
GridCacheAtomicSequenceImpl
public GridCacheAtomicSequenceImpl(String name, GridCacheInternalKey key, IgniteInternalCache<GridCacheInternalKey,GridCacheAtomicSequenceValue> seqView, int batchSize, long locVal, long upBound)
Default constructor.- Parameters:
name- Sequence name.key- Sequence key.seqView- Sequence projection.batchSize- Sequence batch size.locVal- Local counter.upBound- Upper bound.
-
-
Method Detail
-
get
public long get()
Gets current value of atomic sequence.- Specified by:
getin interfaceIgniteAtomicSequence- Returns:
- Value of atomic sequence.
-
incrementAndGet
public long incrementAndGet()
Increments and returns the value of atomic sequence.- Specified by:
incrementAndGetin interfaceIgniteAtomicSequence- Returns:
- Value of atomic sequence after increment.
-
getAndIncrement
public long getAndIncrement()
Gets and increments current value of atomic sequence.- Specified by:
getAndIncrementin interfaceIgniteAtomicSequence- Returns:
- Value of atomic sequence before increment.
-
addAndGet
public long addAndGet(long l)
Addslelements to atomic sequence and gets value of atomic sequence.- Specified by:
addAndGetin interfaceIgniteAtomicSequence- Parameters:
l- Number of added elements.- Returns:
- Value of atomic sequence.
-
getAndAdd
public long getAndAdd(long l)
Gets current value of atomic sequence and addslelements.- Specified by:
getAndAddin interfaceIgniteAtomicSequence- Parameters:
l- Number of added elements.- Returns:
- Value of atomic sequence.
-
batchSize
public int batchSize()
Get local batch size for this sequences.- Specified by:
batchSizein interfaceIgniteAtomicSequence- Returns:
- Sequence batch size.
-
batchSize
public void batchSize(int size)
Set local batch size for this sequences.- Specified by:
batchSizein interfaceIgniteAtomicSequence- Parameters:
size- Sequence batch size. Must be more then 0.
-
invalidateLocalState
protected void invalidateLocalState()
Invalidates local state.- Overrides:
invalidateLocalStatein classAtomicDataStructureProxy<GridCacheAtomicSequenceValue>
-
close
public void close()
Removes this atomic sequence.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIgniteAtomicSequence
-
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
-
-