Merge pull request #1830 from metamx/peonDaemonChecker

Check for non-daemon threads when CliPeon exits
This commit is contained in:
Xavier Léauté 2016-01-11 10:48:52 -08:00
commit 8d1686039a
1 changed files with 10 additions and 0 deletions

View File

@ -85,6 +85,7 @@ import org.eclipse.jetty.server.Server;
import java.io.File; import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
*/ */
@ -246,6 +247,15 @@ public class CliPeon extends GuiceRunnable
) )
); );
injector.getInstance(ExecutorLifecycle.class).join(); 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. // Explicitly call lifecycle stop, dont rely on shutdown hook.
lifecycle.stop(); lifecycle.stop();
} }