Why one can't submit an alternative thread pool to the streams API?
cay.horstmann at gmail.com
Sat Oct 26 14:32:34 UTC 2019
Il 12/10/19 19:03, Brian Goetz ha scritto:
>> It certainly isn't elegant. Perhaps a better way might be an argument
>> to the parallel method that specifies the pool to be used?
> This was discussed early during the development of the streams API, and
> quickly went into the bucket labeled “obvious but wrong.” (It’s in good
> company.) For every case where this is the right move, there are 10,000
> others where it will be an attractive nuisance, but wrong. It wouldn’t
> be fair to Java developers to dangle this option in their face.
> Further, while everyone agrees the real estate between `.parallel(` and
> `)` is the right place to “build” to provide more control over parallel
> execution, no one agrees what we should actually build there. Pretty
> convinced that a FJP is the wrong thing to build there, but still not
> sure what the right thing is, so we leave it undeveloped for now.
That is certainly a fair point. I have the same complaint about
HttpClient.Builder.executor(Executor executor), which has led
More information about the jdk-dev