[concurrency-interest] ConcurrentHashMapV8

Joe Bowbeer joe.bowbeer at gmail.com
Sun Aug 28 17:42:29 EDT 2011


First impressions:

1. I like the MappingFunction name.  I hope the JDK8 name is as clear *and*
specialized.

2. I think the snippet in computeIfAbsent is wrong; should be something
like:

if (map.containsKey(key))
  return map.get(key);
value = mappingFunction.map(key);
if (value != null) {
  map.put(key, value);
}
return value;


Given the restrictions placed on computeIfAbsent's function (invoked
atomically, short & simple, must not attempt to update any other mappings),
I would like to see a more complete example.

3. The javadoc comment on computeVal reads "Implements computeIfAbsent"
which indicates to me that "computeIfAbsent" is an interface.  Even though
this is private-method doc, I suggest "Implementation of computeIfAbsent".
That would be less confusing.

Joe

On Sun, Aug 28, 2011 at 12:24 PM, Doug Lea wrote:

>
> A candidate replacement for java.util.concurrent.**ConcurrentHashMap
> is now available as jsr166e.ConcurrentHashMapV8. This version
> is much more amenable to upcoming support for aggregate
> parallel operations (including, already, method "computeIfAbsent'
> using a stand-in MappingFunction type).
>
> The internal design is interestingly different.
> Read the internal documentation for details.
> (http://gee.cs.oswego.edu/cgi-**bin/viewcvs.cgi/jsr166/src/**
> jsr166e/ConcurrentHashMapV8.**java?view=log<http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166e/ConcurrentHashMapV8.java?view=log>
> )
>
> Please give it a try, and let us know about experiences.
>
> Links:
>    *  API specs:  http://gee.cs.oswego.edu/dl/**jsr166/dist/jsr166edocs/<http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166edocs/>
>    * jar file: http://gee.cs.oswego.edu/dl/**jsr166/dist/jsr166e.jar<http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166e.jar>(compiled using Java7 javac).
>    * Browsable CVS sources: http://gee.cs.oswego.edu/cgi-**
> bin/viewcvs.cgi/jsr166/src/**jsr166e/<http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166e/>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20110828/ce7e9e33/attachment.html>


More information about the Concurrency-interest mailing list