Skip to content

Commit 16968c4

Browse files
committed
Clarify the expected behaviour and state for non-inherited per carrier pollers
1 parent b45d53d commit 16968c4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

core/src/test/java/io/netty/loom/MultithreadVirtualEventExecutorGroupTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,13 @@ record TestStats(int beforeContinuations, int afterContinuations,
497497
int beforeContinuations = beforeNettyScheduler.externalContinuationsCount();
498498
int beforeInheritedSubPollers = (int) countNettyInheritedReadPollerThreads(globalScheduler, beforeNettyScheduler);
499499
try {
500+
// For -Djdk.pollerMode=3:
501+
// When a carrier blocks a per-carrier read sub-poller is started and submitted to Netty's scheduler.
502+
// If the carrier's Thread::currentThread was inherited the sub-poller goes via the global scheduler;
503+
// if the carrier is pinned to the Netty scheduler it is submitted directly.
504+
// Pinned sub-pollers do not have the scoped VirtualThreadNettyScheduler value, but that is safe:
505+
// any VT unparked by the poller is already registered with either the Netty or global scheduler
506+
// and will find the correct scheduler without calling VirtualThreadNettyScheduler.current().
500507
serverIn.read();
501508
var afterNettyScheduler = currentNettyScheduler(globalScheduler);
502509
int afterContinuations = afterNettyScheduler.externalContinuationsCount();

0 commit comments

Comments
 (0)