Loose-ends wrapup

Doug Lea dl at cs.oswego.edu
Sun May 19 14:14:41 PDT 2013

On 05/19/13 15:55, Brian Goetz wrote:
> Our new mantra is "explicit but unobtrusive parallelism."
> As a low-level component, I think the xxx(minParSize...) is a perfectly
> reasonable API.  And xxx(minParSize...) could be argued to meets the mantra, but
> only just barely, because of the Concurrent in the class name.  If the bulk ops
> on CHM were cordoned off via some naming convention to make it clear which
> subset were possibly-parallel, that would help further.

They will be the only ones that have a leading, non-optional
argument, so it's about as explicit as you can get.
An example below.

I'm about to do this. People using CHM bulk tasks have already seen
a few API changes, so one final one is not likely to cause them
to get especially angry, and less angry than they'll someday be if
they don't have this simple tuning mechanism.

... class-level doc ...
  * <p>These bulk operations accept a {@code parallelismThreshold}
  * argument. Methods proceed sequentially if the current map size is
  * estimated to be less than the given threshold. Using a value of
  * {@code Long.MAX_VALUE} suppresses all parallelism.  Using a value
  * of {@code 1} results in maximal parallelism.  In-between values can
  * be used to trade off overhead versus throughput.

      * Returns the result of accumulating the given transformation
      * of all (key, value) pairs using the given reducer to
      * combine values, and the given basis as an identity value.
      * @param parallelismThreshold the (estimated) number of elements
      * needed for this operation to be executed in parallel.
      * @param transformer a function returning the transformation
      * for an element
      * @param basis the identity (initial default value) for the reduction
      * @param reducer a commutative associative combining function
      * @return the result of accumulating the given transformation
      * of all (key, value) pairs
     public long reduceToLong(long parallelismThreshold,
                              ToLongBiFunction<? super K, ? super V> transformer,
                              long basis,
                              LongBinaryOperator reducer) {

More information about the lambda-libs-spec-observers mailing list