RFR: 8319447: Improve performance of delayed task handling [v6]

Doug Lea dl at openjdk.org
Sun Mar 9 17:17:51 UTC 2025


On Thu, 6 Mar 2025 14:34:00 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Maybe it's worth using java.time.Duration, although it doesn't fit into the API very elegantly.
>
>> I wonder if the variance of the Consumer to this method should be more permissible. Something like:
>> 
>> public ForkJoinTask submitWithTimeout(Callable callable, long timeout, TimeUnit unit, Consumer<? super ForkJoinTask<? extends V>> timeoutAction) {
> 
> I think this is a good point but it might be more practical to limit it to just a contravariant Consumer, as in ` Consumer<? super ForkJoinTask<V>>`.

I agree Consumer<? super ForkJoinTask<V>> is sensible. Done.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23702#discussion_r1986372835


More information about the core-libs-dev mailing list