170e4deee6
Motivation The current event loop shutdown logic is quite fragile and in the epoll/NIO cases relies on the default 1 second wait/select timeout that applies when there are no scheduled tasks. Without this default timeout the shutdown would hang indefinitely. The timeout only takes effect in this case because queued scheduled tasks are first cancelled in SingleThreadEventExecutor#confirmShutdown(), but I _think_ even this isn't robust, since the main task queue is subsequently serviced which could result in some new scheduled task being queued with much later deadline. It also means shutdowns are unnecessarily delayed by up to 1 second. Modifications - Add/extend unit tests to expose the issue - Adjust SingleThreadEventExecutor shutdown and confirmShutdown methods to explicitly add no-op tasks to the taskQueue so that the subsequent event loop iteration doesn't enter blocking wait (as looks like was originally intended) Results Faster and more robust shutdown of event loops, allows removal of the default wait timeout |
||
---|---|---|
.. | ||
KQueueAbstractDomainSocketEchoTest.java | ||
KQueueChannelConfigTest.java | ||
KQueueCompositeBufferGatheringWriteTest.java | ||
KQueueDatagramConnectNotExistsTest.java | ||
KQueueDatagramUnicastIPv6MappedTest.java | ||
KQueueDatagramUnicastIPv6Test.java | ||
KQueueDatagramUnicastTest.java | ||
KQueueDetectPeerCloseWithoutReadTest.java | ||
KQueueDomainSocketDataReadInitialStateTest.java | ||
KQueueDomainSocketEchoTest.java | ||
KQueueDomainSocketFdTest.java | ||
KQueueDomainSocketFileRegionTest.java | ||
KQueueDomainSocketFixedLengthEchoTest.java | ||
KQueueDomainSocketGatheringWriteTest.java | ||
KQueueDomainSocketObjectEchoTest.java | ||
KQueueDomainSocketReuseFdTest.java | ||
KQueueDomainSocketShutdownOutputByPeerTest.java | ||
KQueueDomainSocketSslClientRenegotiateTest.java | ||
KQueueDomainSocketSslEchoTest.java | ||
KQueueDomainSocketSslGreetingTest.java | ||
KQueueDomainSocketStartTlsTest.java | ||
KQueueDomainSocketStringEchoTest.java | ||
KQueueETSocketAutoReadTest.java | ||
KQueueETSocketConditionalWritabilityTest.java | ||
KQueueETSocketDataReadInitialStateTest.java | ||
KQueueETSocketExceptionHandlingTest.java | ||
KQueueETSocketHalfClosedTest.java | ||
KQueueETSocketReadPendingTest.java | ||
KQueueEventLoopTest.java | ||
KQueueRcvAllocatorOverrideSocketSslEchoTest.java | ||
KQueueServerSocketChannelConfigTest.java | ||
KQueueSocketChannelConfigTest.java | ||
KQueueSocketChannelNotYetConnectedTest.java | ||
KQueueSocketCloseForciblyTest.java | ||
KQueueSocketConnectionAttemptTest.java | ||
KQueueSocketConnectTest.java | ||
KQueueSocketEchoTest.java | ||
KQueueSocketFileRegionTest.java | ||
KQueueSocketFixedLengthEchoTest.java | ||
KQueueSocketGatheringWriteTest.java | ||
KQueueSocketMultipleConnectTest.java | ||
KQueueSocketObjectEchoTest.java | ||
KQueueSocketRstTest.java | ||
KQueueSocketShutdownOutputByPeerTest.java | ||
KQueueSocketShutdownOutputBySelfTest.java | ||
KQueueSocketSslClientRenegotiateTest.java | ||
KQueueSocketSslEchoTest.java | ||
KQueueSocketSslGreetingTest.java | ||
KQueueSocketSslSessionReuseTest.java | ||
KQueueSocketStartTlsTest.java | ||
KQueueSocketStringEchoTest.java | ||
KQueueSocketTest.java | ||
KQueueSocketTestPermutation.java | ||
KqueueWriteBeforeRegisteredTest.java |