Index: java/org/apache/catalina/loader/WebappClassLoader.java =================================================================== --- java/org/apache/catalina/loader/WebappClassLoader.java (revision 1003433) +++ java/org/apache/catalina/loader/WebappClassLoader.java (working copy) @@ -2179,6 +2179,9 @@ @SuppressWarnings("deprecation") // thread.stop() private void clearReferencesThreads() { Thread[] threads = getThreads(); + + // Is checking for a null value better than using the synchronized method? + boolean shuttingDown = System.getProperties().containsKey("org.apache.catalina.shuttingDown"); // Iterate over the set of threads for (Thread thread : threads) { @@ -2194,6 +2197,11 @@ if (!thread.isAlive()) { continue; } + + // Skip daemon threads if Tomcat is shutting down + if (shuttingDown && thread.isDaemon()) { + continue; + } // Don't warn about JVM controlled threads ThreadGroup tg = thread.getThreadGroup(); Index: java/org/apache/catalina/startup/Catalina.java =================================================================== --- java/org/apache/catalina/startup/Catalina.java (revision 1003433) +++ java/org/apache/catalina/startup/Catalina.java (working copy) @@ -633,6 +633,8 @@ * Stop an existing server instance. */ public void stop() { + + System.setProperty("org.apache.catalina.shuttingDown", String.valueOf(System.currentTimeMillis())); try { // Remove the ShutdownHook first so that server.stop()