Author: slaurent Date: Thu May 22 21:24:06 2014 New Revision: 1596971 URL: http://svn.apache.org/r1596971 Log: hopefully fixed timing issue in TestStuckThreadDetectionValve when the test is run on ASF buildbot...
Modified: tomcat/trunk/test/org/apache/catalina/valves/TestStuckThreadDetectionValve.java Modified: tomcat/trunk/test/org/apache/catalina/valves/TestStuckThreadDetectionValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/valves/TestStuckThreadDetectionValve.java?rev=1596971&r1=1596970&r2=1596971&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/valves/TestStuckThreadDetectionValve.java (original) +++ tomcat/trunk/test/org/apache/catalina/valves/TestStuckThreadDetectionValve.java Thu May 22 21:24:06 2014 @@ -51,7 +51,7 @@ public class TestStuckThreadDetectionVal @Test public void testDetection() throws Exception { // second, we test the actual effect of the flag on the startup - StuckingServlet stuckingServlet = new StuckingServlet(6000L); + StuckingServlet stuckingServlet = new StuckingServlet(8000L); Wrapper servlet = Tomcat.addServlet(context, "myservlet", stuckingServlet); servlet.addMapping("/myservlet"); @@ -82,10 +82,12 @@ public class TestStuckThreadDetectionVal Thread.sleep(500L); Assert.assertEquals(0, valve.getStuckThreadIds().length); - Thread.sleep(3000L); + Thread.sleep(5000L); Assert.assertEquals(1, valve.getStuckThreadIds().length); } finally { - asyncThread.join(); + asyncThread.join(20000); + // check that we did not reach the join timeout + Assert.assertFalse(asyncThread.isAlive()); } Assert.assertFalse(stuckingServlet.wasInterrupted); Assert.assertTrue(result.toString().startsWith("OK")); @@ -127,12 +129,13 @@ public class TestStuckThreadDetectionVal Thread.sleep(4000L); Assert.assertEquals(1, valve.getStuckThreadIds().length); - Thread.sleep(4000L); - Assert.assertTrue(stuckingServlet.wasInterrupted); - Assert.assertEquals(0, valve.getStuckThreadIds().length); } finally { - asyncThread.join(); + asyncThread.join(20000); + // check that we did not reach the join timeout + Assert.assertFalse(asyncThread.isAlive()); } + Assert.assertTrue(stuckingServlet.wasInterrupted); + Assert.assertEquals(0, valve.getStuckThreadIds().length); Assert.assertTrue(result.toString().startsWith("OK")); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org