The IgniteAtomicLong interface provides a long variable that can be read and written atomically, and that also supports advanced atomic operations.
We can create a long value as follows:
IgniteAtomicLong atomicLong = ignite.atomicLong("myLong", // Atomic long name.
0, // Initial value.
true // Create if it does not exist.
);
All operations are atomic in nature. You can change a value as follows:
System.out.println("The new value is - "+atomicLong.addAndGet(2));
The output will look like this: