fastutil icon indicating copy to clipboard operation
fastutil copied to clipboard

ConcurrentMap

Open dmolesUC opened this issue 7 years ago • 7 comments

Is it on the roadmap to add ConcurrentMap implementations? It would be nice to have an atomic putIfAbsent() (something less heavyweight than SynchronizedMap).

dmolesUC avatar Aug 15 '17 18:08 dmolesUC

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.

vigna avatar Aug 15 '17 21:08 vigna

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.

incaseoftrouble avatar Aug 21 '17 07:08 incaseoftrouble

Is this still on the road map?

Kroppeb avatar Jul 03 '20 19:07 Kroppeb

Not in the near future, I'm swamped :(.

vigna avatar Jul 03 '20 19:07 vigna

I really need ConcurrentMap, but take your time :)

ghost avatar Feb 25 '21 14:02 ghost

Sigh a PR maybe? 😂

vigna avatar Feb 25 '21 18:02 vigna

@vigna @ghost is this maybe useful and/or could this be merged into the core? https://github.com/trivago/fastutil-concurrent-wrapper

ddsky avatar May 09 '23 16:05 ddsky