Skip to content

Commit

Permalink
Merge pull request apache#1830 from metamx/peonDaemonChecker
Browse files Browse the repository at this point in the history
Check for non-daemon threads when CliPeon exits
  • Loading branch information
xvrl committed Jan 11, 2016
2 parents fafc7c0 + 194f632 commit 8d16860
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/src/main/java/io/druid/cli/CliPeon.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

/**
*/
Expand Down Expand Up @@ -246,6 +247,15 @@ public void run()
)
);
injector.getInstance(ExecutorLifecycle.class).join();

// Sanity check to help debug unexpected non-daemon threads
final Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
for (Thread thread : threadSet) {
if (!thread.isDaemon() && thread != Thread.currentThread()) {
log.info("Thread [%s] is non daemon.", thread);
}
}

// Explicitly call lifecycle stop, dont rely on shutdown hook.
lifecycle.stop();
}
Expand Down

0 comments on commit 8d16860

Please sign in to comment.