[concurrency-interest] ConcurrentHashMapV8 Livelock on computeIfAbsent() ?
dl at cs.oswego.edu
Wed Apr 20 08:27:08 EDT 2016
On 04/19/2016 11:43 AM, Per Mildner wrote:
>> In any concurrent context, a computeIfAbsent function with side effects
>> that that modify map entries (including especially the initially absent one)
> The documentation seems to explicitly exclude the initially absent map entry from the prohibited entries by saying "the computation … must not attempt to update any _other_ mappings”.
> Should this say "the computation … must not attempt to update any mappings”?
Yes. The wording implicitly assumed that readers already knew not to
modify the key's mapping.
In any case, this is already partially covered in the Map javadocs:
* <p>The mapping function should not modify this map during computation.
We could add something saying what might happen otherwise:
* If it does so, the results of this operation are undefined, but may
* include IllegalStateExceptions, or in concurrent contexts, deadlock
* or livelock.
More information about the Concurrency-interest