On Wed, 27 Aug 2025 05:32:36 GMT, He-Pin(kerr) <d...@openjdk.org> wrote:
>> Yes, it means we always adapt before calling submit, lazySubmit and >> externalSubmit rather than the mix of execute(Runnable) and xxxSubmit. > > If it's already a `AdaptedRunnable` should we adapt it too? if not, can we > change the `ForkJoinTask.adapt` to something : > > public static ForkJoinTask<?> adapt(Runnable runnable) { > if (runnable instanceOf AdaptedRunnableAction action) > return action > else return new AdaptedRunnableAction(runnable); > } Seems reasonable to do. public static ForkJoinTask<?> adapt(Runnable runnable) { return (runnable instanceOf AdaptedRunnableAction adapted) ? adapted : new AdaptedRunnableAction(runnable); } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2303303217