Package org.apache.ignite
Interface IgniteAtomicReference<T>
-
- All Superinterfaces:
AutoCloseable,Closeable
public interface IgniteAtomicReference<T> extends Closeable
This interface provides a rich API for working with distributed atomic reference.Functionality
Distributed atomic reference includes the following main functionality:-
Method
get()gets current value of an atomic reference. -
Method
set(Object)unconditionally sets the value in the an atomic reference. -
Methods
compareAndSet(...)conditionally set the value in the an atomic reference. -
Method
name()gets name of atomic reference.
Creating Distributed Atomic Reference
Instance of distributed atomic reference 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 reference.booleancompareAndSet(T expVal, T newVal)Conditionally sets the new value.Tget()Gets current value of an atomic reference.Stringname()Name of atomic reference.booleanremoved()Gets status of atomic.voidset(T val)Unconditionally sets the value.
-
-
-
Method Detail
-
name
String name()
Name of atomic reference.- Returns:
- Name of an atomic reference.
-
get
T get() throws IgniteException
Gets current value of an atomic reference.- Returns:
- current value of an atomic reference.
- Throws:
IgniteException- If operation failed.
-
set
void set(T val) throws IgniteException
Unconditionally sets the value.- Parameters:
val- Value.- Throws:
IgniteException- If operation failed.
-
compareAndSet
boolean compareAndSet(T expVal, T newVal) throws IgniteException
Conditionally sets the new value. That will be set ifexpValis equal to current value respectively.- Parameters:
expVal- Expected value.newVal- New value.- Returns:
- Result of operation execution. If
truethan value have been updated. - Throws:
IgniteException- If operation failed.
-
removed
boolean removed()
Gets status of atomic.- Returns:
trueif an atomic reference was removed from cache,falseotherwise.
-
close
void close()
Removes this atomic reference.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IgniteException- If operation failed.
-
-