Browsing index pages (2 articles)
↧
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 ArticleAnswer 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
Browsing index pages (2 articles)