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 void
close()
Removes this atomic reference.boolean
compareAndSet(T expVal, T newVal)
Conditionally sets the new value.T
get()
Gets current value of an atomic reference.String
name()
Name of atomic reference.boolean
removed()
Gets status of atomic.void
set(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 ifexpVal
is equal to current value respectively.- Parameters:
expVal
- Expected value.newVal
- New value.- Returns:
- Result of operation execution. If
true
than value have been updated. - Throws:
IgniteException
- If operation failed.
-
removed
boolean removed()
Gets status of atomic.- Returns:
true
if an atomic reference was removed from cache,false
otherwise.
-
close
void close()
Removes this atomic reference.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IgniteException
- If operation failed.
-
-