Quantcast
Channel: Java ConcurrentHashMap Get and Put Atomically - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by yshavit for Java ConcurrentHashMap Get and Put Atomically

You can combine the Map with an AtomicLong: the Map for getting an AtomicLong per mapKey, and then compareAndSet on the AtomicLong for the atomicity you need.private Map<String, AtomicLong> ids =...

View Article



Java ConcurrentHashMap Get and Put Atomically

I have a ConcurrentHashMap and i want to guarantee that the .get and .put operations are Atomic. From what i have analyzed, compute is not an option for me here, because i have to do some important...

View Article
Browsing all 2 articles
Browse latest View live




Latest Images