arina-ielchiieva commented on a change in pull request #1625: DRILL-7008:
Drillbits: clear stale shutdown hooks
URL: https://github.com/apache/drill/pull/1625#discussion_r251376457
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
##########
@@ -258,6 +260,13 @@ public synchronized void close() {
}
final Stopwatch w = Stopwatch.createStarted();
logger.debug("Shutdown begun.");
+ // We don't really want for Drillbits to pile up in memory, so the hook
should be removed
+ // It might be better to use PhantomReferences to cleanup as soon as
Drillbit becomes
+ // unreachable, however current approach seems to be good enough.
+ Thread shutdownHook = this.shutdownHook;
+ if (shutdownHook != null && Thread.currentThread() != shutdownHook) {
+ Runtime.getRuntime().removeShutdownHook(shutdownHook);
Review comment:
Frankly saying, I am not sure. Can you please point to the reference that
says that thread check is enough?
----------------------------------------------------------------
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