Concurrent Hash Map javadoc question
Keith Turner
keith at deenlo.com
Wed Sep 18 14:23:11 UTC 2019
On Tue, Sep 17, 2019 at 9:35 PM Martin Buchholz <martinrb at google.com> wrote:
>
> I think this doc difference is intentional.
If that is the case, it would be really nice update the javadoc to
make it explicit.
>
> In case of a retry loop, the value may have changed in the case of computeIfPresent or compute and so the function must be called again with the new value.
>
> On Tue, Sep 17, 2019 at 4:36 PM Martijn Verburg <martijnverburg at gmail.com> wrote:
>>
>> Hi Keith,
>>
>> I think this is one for concurrency interest to answer.
>>
>> Cheers,
>> Martijn
>>
>>
>> On Tue, 17 Sep 2019 at 12:48, Keith Turner <keith at deenlo.com> wrote:
>>
>> > The javadoc for ConcurrentHashMap.computeIfAbsent() states the
>> > remapping function is applied at most once. The functions
>> > computeIfPresent() and compute() do not explicitly state if the
>> > remapping functions could possibly be run multiple times. Does anyone
>> > know if computeIfPresent() and compute() are guaranteed to only run
>> > the remapping functions at most once? If so, should the javadoc be
>> > updated?
>> >
>> > Thanks,
>> >
>> > Keith
>> >
More information about the discuss
mailing list