IgniteAtomicReference as large atomic counter

classic Classic list List threaded Threaded
3 messages Options
gjwilk gjwilk
Reply | Threaded
Open this post in threaded view
|

IgniteAtomicReference as large atomic counter

My requirements call for creation of shared amount buckets/counters in the cluster.  Given required scale/precision of my counters use of IgniteAtomicLong won't be adequate.  I am thinking about using IgniteAtomicReference<Double> or some such wrapper to hold double primitive to accomplish that.  However, I couldn't find a getAndAlter()-like method on IgniteAtomicReference that would allow me to perform counter increase atomically.  Preferably, there would be getAndAlter(function) method, which would perform set of operations on the counter atomically.

Any suggestions on how this can be implemented would be greatly appreciated.

Thanks in advance!
~george
gjwilk gjwilk
Reply | Threaded
Open this post in threaded view
|

Re: IgniteAtomicReference as large atomic counter

Sounds like it might be a job for EntryProcessor, which executes atomically in scope of cache key.
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: IgniteAtomicReference as large atomic counter

Hi George,

Yes, EntryProcessor looks like the best candidate to implement this functionality. Let us know if you have additional questions.

-Val