You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/09/10 13:54:42 UTC

svn commit: r1521444 - /tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java

Author: markt
Date: Tue Sep 10 11:54:41 2013
New Revision: 1521444

URL: http://svn.apache.org/r1521444
Log:
Reduce timing sensitivity of test as some false positives have been observed.

Modified:
    tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java

Modified: tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java?rev=1521444&r1=1521443&r2=1521444&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java (original)
+++ tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java Tue Sep 10 11:54:41 2013
@@ -59,17 +59,18 @@ public class TestWebappClassLoaderMemory
         // Stop the context
         ctx.stop();
 
-        // If the thread still exists, we have a thread/memory leak
-        try {
-            Thread.sleep(10);
-        } catch(InterruptedException ie) {
-            // ignore
-        }
         Thread[] threads = getThreads();
         for (Thread thread : threads) {
             if (thread != null && thread.isAlive() &&
                     TaskServlet.TIMER_THREAD_NAME.equals(thread.getName())) {
-                fail("Timer thread still running");
+                int count = 0;
+                while (count < 50 && thread.isAlive()) {
+                    Thread.sleep(100);
+                    count++;
+                }
+                if (thread.isAlive()) {
+                    fail("Timer thread still running");
+                }
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org