November 2018
Beginner to intermediate
260 pages
6h 12m
English
The IgniteAtomicReference interface provides an object reference variable that can be read and written atomically.
We can define a reference with an initial value as follows:
IgniteAtomicReference<String> ref = ignite.atomicReference("myRef", // atomic Reference name. "myValue", // Initial value for atomic reference. true // Create if it does not exist. );
We defined a string reference, but you can define any type of your choice. One important method of IgniteAtomicReference is compareAndSet(T expVal, T newVal). This method conditionally sets the new value if expVal is equal to the current value. This behavior is similar to optimistic locking: when you update a value, you must have the most recent object. If anyone ...
Read now
Unlock full access