Author: rjung
Date: Tue Dec 17 14:09:52 2013
New Revision: 1551546

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

Backport of r1521444 from trunk.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    
tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1521444

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java?rev=1551546&r1=1551545&r2=1551546&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
 Tue Dec 17 14:09:52 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 &&
+            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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to