Skip to content

Commit f656651

Browse files
committed
Improve documentation in NettyScheduler for clarity on virtual thread inheritance rules
1 parent 6749c05 commit f656651

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

core/src/main/java/io/netty/loom/NettyScheduler.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,23 @@
77
/**
88
* Global Netty scheduler proxy for virtual threads.
99
*
10-
* <p>Exact inheritance rule: a newly started virtual thread will inherit the
11-
* caller's {@code EventLoopScheduler} only when both of the following are true:
12-
* <ul>
10+
* <p>Inheritance rule (exact): a newly started virtual thread inherits the
11+
* caller's {@code EventLoopScheduler} only when both conditions are true:
12+
* <ol>
1313
* <li>{@code jdk.pollerMode} is {@code 3} (per-carrier pollers); and</li>
14-
* <li>the thread performing the start/poller I/O is itself run by an
15-
* {@code EventLoopScheduler} (i.e. the current thread's
16-
* {@code EventLoopScheduler.currentThreadSchedulerContext().scheduler()} is
17-
* non-null).</li>
18-
* </ul>
14+
* <li>the thread performing the start/poller I/O is itself running under an
15+
* {@code EventLoopScheduler} (i.e. {@code EventLoopScheduler.currentThreadSchedulerContext().scheduler()}
16+
* returns a non-null {@code SharedRef}).</li>
17+
* </ol>
1918
*
20-
* <p>If either condition is false the virtual thread does not inherit an
21-
* {@code EventLoopScheduler} and falls back to the default JDK scheduler.
19+
* <p>The current implementation only attempts scheduler inheritance for
20+
* poller-created virtual threads (recognized by the {@code "-Read-Poller"}
21+
* name suffix). If either condition above is not met (or the thread kind is
22+
* unrecognized) the virtual thread falls back to the default JDK scheduler.
2223
*
23-
* <p>Implementation note: the current implementation attempts inheritance only
24-
* for poller-created virtual threads (recognized by the {@code "-Read-Poller"}
25-
* name suffix).
26-
*
27-
* <p>This class is a proxy/dispatcher; see {@link EventLoopScheduler} for
28-
* details about scheduler attachment and execution.
24+
* <p>This class is a proxy/dispatcher and does not implement a standalone
25+
* scheduling policy. See {@link EventLoopScheduler} for details about scheduler
26+
* attachment and execution.
2927
*/
3028

3129
public class NettyScheduler implements Thread.VirtualThreadScheduler {

0 commit comments

Comments
 (0)