maytasm commented on a change in pull request #10467:
URL: https://github.com/apache/druid/pull/10467#discussion_r499916280



##########
File path: 
core/src/main/java/org/apache/druid/data/input/impl/TimedShutoffInputSourceReader.java
##########
@@ -68,8 +68,10 @@ public TimedShutoffInputSourceReader(InputSourceReader 
delegate, DateTime shutof
   )
   {
     final Closer closer = Closer.create();
-    closer.register(delegateIterator);
+    // We must register the shutdownNow method of the shutdown executor first. 
This will cause the shutdown executor
+    // to be closed last and ensure other resources which depend on it can 
close successfully.
     closer.register(exec::shutdownNow);

Review comment:
       3. Added tests for the following cases:
   - Main thread close the iterator using the close() method (iterator 
successfully closed before timeout)
   - Timeout close the iterator (iterator successfully closed by timeout before 
the close() of the iterator is called in the main thread)
   - Timeout close the iterator and then while it is still closing, main thread 
close the iterator using the close() method
   - Main thread close the iterator using the close() method and then while it 
is still closing, timeout close the iterator.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to