RFR 8190974 Parallel stream execution within a custom ForkJoinPool should obey the parallelism

Paul Sandoz paul.sandoz at oracle.com
Wed Nov 15 00:34:13 UTC 2017



> On 11 Nov 2017, at 07:58, Stefan Zobel <spliterator at gmail.com> wrote:
> 
> In CustomFJPoolTest#testCustomPools()
> 
>>>   assertEquals(splitsForPC, splitsForPHalfC * 2);
> 
> 
> I'm sure I'm slow on the uptake, but isn't this bound to
> fail for every commonParallelism == 2^n + 1 in the closed
> range [2, 127], i.e., for 3, 5, 9, 17, 33, 65?
> 

Ooops! yes, thanks for catching that.

I updated the test to do this:

  assertTrue(splitsForPHalfC < splitsForPC);
  assertEquals(splitsForPC / splitsForPHalfC,
               nearestPowerOfTwo(commonParallelism) / nearestPowerOfTwo(commonParallelism / 2));

http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8190974-par-stream-custom-pool/webrev/test/jdk/java/util/stream/CustomFJPoolTest.java.html

Paul.


More information about the core-libs-dev mailing list