Check for non-daemon threads when CliPeon exits

This commit is contained in:
Charles Allen 2015-10-14 10:45:49 -07:00
parent c9d6994040
commit 194f632b00
1 changed files with 10 additions and 0 deletions

View File

@ -76,6 +76,7 @@ import org.eclipse.jetty.server.Server;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
/**
*/
@ -223,6 +224,15 @@ public class CliPeon extends GuiceRunnable
)
);
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();
}