RFR: 8360046: Scalability issue when submitting virtual threads with almost empty tasks [v5]

Alan Bateman alanb at openjdk.org
Tue Aug 12 07:53:17 UTC 2025


On Mon, 11 Aug 2025 16:43:05 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/VirtualThread.java line 324:
>> 
>>> 322:         } else {
>>> 323:             executor.execute(task);
>>> 324:         }
>> 
>> Is this worth special-casing—IIRC FJP::submit adapts the task if needed already.
>
> Ah, this is about getting a `AdaptedRunnableAction` rather than a `RunnableExecuteAction` (where the latter is an InterruptibleTask, and the former isn't). Sounds worth of a comment here?

Yes, it means we always adapt before calling submit, lazySubmit and externalSubmit rather than the mix of execute(Runnable) and xxxSubmit.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26479#discussion_r2269004280


More information about the core-libs-dev mailing list