Package org.apache.ignite
Interface IgniteAtomicStamped<T,S>
-
- All Superinterfaces:
AutoCloseable,Closeable
public interface IgniteAtomicStamped<T,S> extends Closeable
This interface provides a rich API for working with distributed atomic stamped value.Functionality
Distributed atomic stamped includes the following main functionality:-
Method
get()gets both value and stamp of atomic. -
Method
value()gets current value of atomic. -
Method
stamp()gets current stamp of atomic. -
Method
set(Object, Object)unconditionally sets the value and the stamp in the atomic. -
Methods
compareAndSet(...)conditionally set the value and the stamp in the atomic. -
Method
name()gets name of atomic stamped.
Creating Distributed Atomic Stamped
Instance of distributed atomic stamped can be created by calling the following method:
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Removes this atomic stamped.booleancompareAndSet(T expVal, T newVal, S expStamp, S newStamp)Conditionally sets the new value and new stamp.IgniteBiTuple<T,S>get()Gets both current value and current stamp of atomic stamped.Stringname()Name of atomic stamped.booleanremoved()Gets status of atomic.voidset(T val, S stamp)Unconditionally sets the value and the stamp.Sstamp()Gets current stamp.Tvalue()Gets current value.
-
-
-
Method Detail
-
name
String name()
Name of atomic stamped.- Returns:
- Name of atomic stamped.
-
get
IgniteBiTuple<T,S> get() throws IgniteException
Gets both current value and current stamp of atomic stamped.- Returns:
- both current value and current stamp of atomic stamped.
- Throws:
IgniteException- If operation failed.
-
set
void set(T val, S stamp) throws IgniteException
Unconditionally sets the value and the stamp.- Parameters:
val- Value.stamp- Stamp.- Throws:
IgniteException- If operation failed.
-
compareAndSet
boolean compareAndSet(T expVal, T newVal, S expStamp, S newStamp) throws IgniteException
Conditionally sets the new value and new stamp. They will be set ifexpValandexpStampare equal to current value and current stamp respectively.- Parameters:
expVal- Expected value.newVal- New value.expStamp- Expected stamp.newStamp- New stamp.- Returns:
- Result of operation execution. If
truethan value and stamp will be updated. - Throws:
IgniteException- If operation failed.
-
stamp
S stamp() throws IgniteException
Gets current stamp.- Returns:
- Current stamp.
- Throws:
IgniteException- If operation failed.
-
value
T value() throws IgniteException
Gets current value.- Returns:
- Current value.
- Throws:
IgniteException- If operation failed.
-
removed
boolean removed()
Gets status of atomic.- Returns:
trueif atomic stamped was removed from cache,falseotherwise.
-
close
void close()
Removes this atomic stamped.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IgniteException- If operation failed.
-
-