RFR 8005311: Add Scalable Updatable Variables, DoubleAccumulator, DoubleAdder, LongAccumulator, LongAdder (original) (raw)

Doug Lea dl at cs.oswego.edu
Sun Jan 6 11:39:36 UTC 2013


On 01/05/13 18:42, Remi Forax wrote:

The code is not very java-ish,

But is very consistent across j.u.c. As a convention, inline assignments to locals are used to hold field reads to visually ensure use of consistent snapshots. The C-like look-and-feel is a less important than is ability to simply check these cases by inspection.

Overall, I think there are too many lazy initializations. Unlike HashMap, if a developer uses let say LongAccumulator it's because AtomicLong doesn't work well, so not having the array of cells initialized by default seems weird.

You wouldn't say this if you were on a 256-way machine with millions of LongAdders, where only a thousand of them heavily contended :-)

-Doug



More information about the core-libs-dev mailing list