Re: Concurrent Hash Map javadoc question
Benjamin Manes via Concurrency-interest <[email protected]>
| Newsgroups | gmane.comp.java.jsr.166-concurrency,gmane.comp.java.openjdk.general |
|---|---|
| Message-ID | <CAGu0=MM=a+4i85MYxqtHeGi2kO23zqLGAHNOc5JtwCg1oHnowg@mail.gmail.com> |
All three state that "The entire method invocation is performed atomically" and computeIfAbsent merely explains this with the addition "so the function is applied at most once per key." Since all computations are atomic operations in ConcurrentHashMap, this seems to be implied in the other cases rather than explicitly clarified. On Tue, Sep 17, 2019 at 6:36 PM Martin Buchholz via Concurrency-interest < [email protected]> wrote: > I think this doc difference is intentional. > > 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 <[email protected]> > 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 <[email protected]> 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 >> > >> > _______________________________________________ > Concurrency-interest mailing list > [email protected] > http://cs.oswego.edu/mailman/listinfo/concurrency-interest > _______________________________________________ Concurrency-interest mailing list [email protected] http://cs.oswego.edu/mailman/listinfo/concurrency-interest