sohami commented on a change in pull request #1536: DRILL-6039: Fixed
drillbit.sh script to do graceful shutdown
URL: https://github.com/apache/drill/pull/1536#discussion_r235505271
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
##########
@@ -335,6 +351,50 @@ private void javaPropertiesToSystemOptions() {
}
}
+
+ // Polls for graceful file to check if graceful shutdown is triggered from
the script.
+ private static class PollShutdownThread extends Thread {
+
+ private final Drillbit drillbit;
+ private final StackTrace stackTrace;
+
+ public PollShutdownThread(final Drillbit drillbit, final StackTrace
stackTrace) {
+ this.drillbit = drillbit;
+ this.stackTrace = stackTrace;
+ }
+
+ @Override
+ public void run () {
+ try {
+ pollShutdown(drillbit);
+ } catch (Exception e) {
+ throw new RuntimeException("Caught exception while polling for
shutdown\n" + stackTrace, e);
+ }
Review comment:
I think you have to catch `InterruptedException` and consume it after
logging rather than throwing `RuntimeException` for it. Since when
`Drillbit.close` is called from another path it will interrupt this thread and
we should not throw `RuntimeException` in that case.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services