RFR 8005311: Add Scalable Updatable Variables, DoubleAccumulator, DoubleAdder, LongAccumulator, LongAdder
martinrb at google.com
Sat Jan 5 20:10:04 UTC 2013
I did a bit of review.
"""The supplied accumulator function must be side-effect-free. It may be
re-applied when attempted updates fail due to contention among threads. """
Too strong. I prefer """The supplied accumulator function should be
side-effect-free, since it may be re-applied when attempted updates fail
due to contention among threads. """ Users can usefully use side effects
for e.g. performance monitoring or debugging.
Double.MINIMUM_VALUE - WAT? The alternative Double.MIN_VALUE actually
exists, but is also inappropriate, since it's positive. Why not
Double.NEGATIVE_INFINITY, which is a true identity for max (ignoring NaN)?
Chris, the internal links in your generated javadoc are broken, e.g. I
Maybe the webrev tool needs fixing (as always?) ?
There need to be more docs on the requirements on the accumulatorFunction,
public void reset()
Resets variables maintaining updates the given value.
That sentence english not. There is no "given value". Perhaps "Resets
variables maintaining the accumulated value to the identity."""
Class DoubleAdder provides analogs of the functionality of this class for
the common special case of maintaining sums.)
I would add a code sample showing how to create a DoubleAccumulator
equivalent to a DoubleAdder.
but does not define methods such as hashCode and compareTo
I would include equals in that list of methods.
More information about the core-libs-dev