You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2008/11/24 23:21:15 UTC
svn commit: r720310 -
/tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java
Author: fhanik
Date: Mon Nov 24 14:21:15 2008
New Revision: 720310
URL: http://svn.apache.org/viewvc?rev=720310&view=rev
Log:
make sure the test is time based
Modified:
tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java
Modified: tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java?rev=720310&r1=720309&r2=720310&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java (original)
+++ tomcat/trunk/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java Mon Nov 24 14:21:15 2008
@@ -48,7 +48,7 @@
totalfetch += t.nroffetch;
minfetch = Math.min(minfetch, t.nroffetch);
maxfetch = Math.max(maxfetch, t.nroffetch);
- //System.out.println(t.getName()+" : Nr-of-fetch:"+t.nroffetch+ " Max fetch Time:"+t.max+" :Max close time:"+t.cmax);
+ System.out.println(t.getName()+" : Nr-of-fetch:"+t.nroffetch+ " Max fetch Time:"+t.max+" :Max close time:"+t.cmax);
}
System.out.println("["+name+"] Max fetch:"+maxfetch+" Min fetch:"+minfetch+" Average fetch:"+
(((float)totalfetch))/(float)threads.length);
@@ -73,7 +73,9 @@
for (int i=0; i<threadcount; i++) {
threads[i].start();
}
- latch.await(complete,TimeUnit.MILLISECONDS);
+ if (!latch.await(complete+1000,TimeUnit.MILLISECONDS)) {
+ System.out.println("Latch timed out.");
+ }
this.run = false;
long delta = System.currentTimeMillis() - start;
printThreadResults(threads,"testDBCPThreads20Connections10");
@@ -100,7 +102,9 @@
for (int i=0; i<threadcount; i++) {
threads[i].start();
}
- latch.await(complete,TimeUnit.MILLISECONDS);
+ if (!latch.await(complete+1000,TimeUnit.MILLISECONDS)) {
+ System.out.println("Latch timed out.");
+ }
this.run = false;
long delta = System.currentTimeMillis() - start;
printThreadResults(threads,"testPoolThreads20Connections10");
@@ -129,7 +133,9 @@
for (int i=0; i<threadcount; i++) {
threads[i].start();
}
- latch.await(complete,TimeUnit.MILLISECONDS);
+ if (!latch.await(complete+1000,TimeUnit.MILLISECONDS)) {
+ System.out.println("Latch timed out.");
+ }
this.run = false;
long delta = System.currentTimeMillis() - start;
printThreadResults(threads,"testPoolThreads20Connections10Fair");
@@ -145,7 +151,9 @@
long max = -1, totalmax=0, totalcmax=0, cmax = -1, nroffetch = 0, totalruntime = 0;
public void run() {
try {
+ long now = System.currentTimeMillis();
while (FairnessTest.this.run) {
+ if ((System.currentTimeMillis()-now)>=FairnessTest.this.complete) break;
long start = System.nanoTime();
Connection con = null;
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org