You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2014/10/26 01:52:37 UTC
svn commit: r1634261 - in /tomcat/tc7.0.x/trunk: ./
test/org/apache/catalina/connector/TestCoyoteAdapter.java
Author: kkolinko
Date: Sat Oct 25 23:52:36 2014
New Revision: 1634261
URL: http://svn.apache.org/r1634261
Log:
Improve test for BZ 54928: Cut down wait time by using Thread.join(time) instead of Thread.sleep().
The actual wait time after the change becomes 2s instead of 250ms.
Merged r1634260 from tomcat/trunk.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1634260
Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java?rev=1634261&r1=1634260&r2=1634261&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestCoyoteAdapter.java Sat Oct 25 23:52:36 2014
@@ -315,13 +315,17 @@ public class TestCoyoteAdapter extends T
client.disconnect();
// Wait for server thread to stop
- int count = 0;
- while (servlet.getThread().isAlive() && count < 20) {
- Thread.sleep(250);
- count ++;
+ Thread t = servlet.getThread();
+ long startTime = System.nanoTime();
+ for (int count = 0; t.isAlive() && count < 20; count++) {
+ t.join(250);
+ if (!t.isAlive()) {
+ break;
+ }
}
- log.info("Waited for servlet thread to stop for " + (count * 250)
- + " ms");
+ long endTime = System.nanoTime();
+ log.info("Waited for servlet thread to stop for "
+ + (endTime - startTime) / 1000000 + " ms");
Assert.assertTrue(servlet.isCompleted());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org