fastutil
fastutil copied to clipboard
ConcurrentMap
Is it on the roadmap to add ConcurrentMap implementations? It would be nice to have an atomic putIfAbsent()
(something less heavyweight than SynchronizedMap
).
Well, putIfAbsent has been already implemented and if you synchronize a fastutil map it will be atomic, too...
On August 15, 2017 8:14:00 PM GMT+02:00, David Moles [email protected] wrote:
Is it on the roadmap to add ConcurrentMap implementations? It would be nice to have an atomic
putIfAbsent()
.-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/vigna/fastutil/issues/81
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
The difference between fully synchronizing the map and having a concurrent map is (as far as I know) that the synchronized map usually gives a stronger atomicity than required. A concurrent hash map for example might lock each bucket individually or use read-write-locks compared to always locking the whole map.
Bottom line: Definitely possible to do, but a lot of work (testing atomicity is a real pain ...). One definitely could "fastutilize" the ConcurrentMap
interface (this shouldn't be too difficult) and then do the same for the reference implementations.
Is this still on the road map?
Not in the near future, I'm swamped :(.
I really need ConcurrentMap, but take your time :)
Sigh a PR maybe? 😂
@vigna @ghost is this maybe useful and/or could this be merged into the core? https://github.com/trivago/fastutil-concurrent-wrapper