ConcurrentHashMap/ConcurrentMap/Map.compute
Doug Lea
dl at cs.oswego.edu
Wed Dec 5 13:33:04 PST 2012
On 12/05/12 16:25, Mike Duigou wrote:
> The problem is that you can't write an atomic putIfAbsent default method in terms of the existing Map API. Thus far we've only contemplated defaults that can match any atomicity expectations provided by the non-default methods.
>
Right. The idea is that ALL of these would have the same disclaimer as the
new lambda-friendly ones I listed:
*
* <p>The default implementation makes no guarantees about
* synchronization or atomicity properties of this method. Any
* class overriding this method must specify its concurrency
* properties.
*
For CHM and related classes, you need each of the original
four ConcurrentMap methods, and the four new functional ones
because without them there's no way to get atomicity
in these contexts.
But some people like them for the sake of encapsulating
common forms under standard names even if not atomic.
I don't have a strong opinion about it, which is why I asked.
-Doug
More information about the lambda-libs-spec-observers
mailing list