From: fhanik Date: Tue, 21 Apr 2009 01:14:36 +0000 (+0000) Subject: not sure what went wrong, my SVN is going ape #!$ X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ee6dad9b1d77c4c33f382e22e924ef0e0ea9bce7;p=tomcat7.0 not sure what went wrong, my SVN is going ape #!$ git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@766936 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java index 1dac78b0d..e61e995ac 100644 --- a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java +++ b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/FairnessTest.java @@ -38,25 +38,34 @@ public class FairnessTest extends DefaultTestCase { } protected boolean run = true; - protected long sleep = 10; - protected long complete = 20000; + protected long sleep = Long.getLong("sleep", 10); + protected long complete = Long.getLong("complete",20000); + protected boolean printthread = Boolean.getBoolean("printthread"); CountDownLatch latch = null; protected void printThreadResults(TestThread[] threads, String name) { long minfetch = Long.MAX_VALUE, maxfetch = Long.MIN_VALUE, totalfetch = 0; + long maxwait = 0, minwait = Long.MAX_VALUE, averagewait = 0, totalwait = 0; float avgfetch = 0; for (int i=0; i0) sleep(FairnessTest.this.sleep); } catch (InterruptedException x) { interrupted(); } @@ -229,9 +236,9 @@ public class FairnessTest extends DefaultTestCase { } if (System.getProperty("print-thread-stats")!=null) { System.out.println("["+getName()+"] "+ - "\n\tMax time to retrieve connection:"+(((float)max)/1000f/1000f)+" ms."+ - "\n\tTotal time to retrieve connection:"+(((float)totalmax)/1000f/1000f)+" ms."+ - "\n\tAverage time to retrieve connection:"+(((float)totalmax)/1000f/1000f)/(float)nroffetch+" ms."+ + "\n\tMax time to retrieve connection:"+(((float)maxwait)/1000f/1000f)+" ms."+ + "\n\tTotal time to retrieve connection:"+(((float)totalwait)/1000f/1000f)+" ms."+ + "\n\tAverage time to retrieve connection:"+(((float)totalwait)/1000f/1000f)/(float)nroffetch+" ms."+ "\n\tMax time to close connection:"+(((float)cmax)/1000f/1000f)+" ms."+ "\n\tTotal time to close connection:"+(((float)totalcmax)/1000f/1000f)+" ms."+ "\n\tAverage time to close connection:"+(((float)totalcmax)/1000f/1000f)/(float)nroffetch+" ms."+ @@ -241,3 +248,4 @@ public class FairnessTest extends DefaultTestCase { } } } + diff --git a/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestException.java b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestException.java new file mode 100644 index 000000000..f25bb6019 --- /dev/null +++ b/modules/jdbc-pool/test/org/apache/tomcat/jdbc/test/TestException.java @@ -0,0 +1,42 @@ +package org.apache.tomcat.jdbc.test; + +import java.lang.reflect.Method; +import java.sql.Connection; +import java.sql.SQLException; + +import org.apache.tomcat.jdbc.pool.ConnectionPool; +import org.apache.tomcat.jdbc.pool.JdbcInterceptor; +import org.apache.tomcat.jdbc.pool.PooledConnection; +import org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor; +import org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport; + +public class TestException extends DefaultTestCase { + + public TestException(String name) { + super(name); + } + + public void testException() throws Exception { + init(); + datasource.getPoolProperties().setJdbcInterceptors(TestInterceptor.class.getName()); + Connection con = datasource.getConnection(); + try { + con.createStatement(); + }catch (Exception x) { + + } + } + + + public static class TestInterceptor extends JdbcInterceptor { + + @Override + public void reset(ConnectionPool parent, PooledConnection con) { + // TODO Auto-generated method stub + + } + + + } + +}