Author: sebb Date: Wed Jan 6 11:05:59 2010 New Revision: 896387 URL: http://svn.apache.org/viewvc?rev=896387&view=rev Log: DBCP-318 is now fixed, so disable extra debug
Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=896387&r1=896386&r2=896387&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original) +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Wed Jan 6 11:05:59 2010 @@ -739,24 +739,20 @@ if (expectError) { // Perform initial sanity check: assertTrue("Expected some of the threads to fail",failed > 0); - /* - * Half of the threads should fail; however currently this does not always happen for TestPerUserPoolDataSource. - * This appears to be due to the pool allowing more than max connections, rather than a test bug, - * but this is not yet fully investigated, hence the extra debug below. - */ - if (pts.length/2 != failed){ - for (int i = 0; i < pts.length; i++) { - PoolTest pt = pts[i]; - System.out.println( - "StartupDelay: " + (pt.started-pt.created) - + ". ConnectTime: " + (pt.connected > 0 ? Long.toString(pt.connected-pt.started) : "-") - + ". Runtime: " + (pt.ended-pt.started) - + ". Loops: " + pt.loops - + ". State: " + pt.state - + ". thrown: "+ pt.thrown - ); - } - } +// DBCP-318 is now fixed, so disable extra debug +// if (pts.length/2 != failed){ +// for (int i = 0; i < pts.length; i++) { +// PoolTest pt = pts[i]; +// System.out.println( +// "StartupDelay: " + (pt.started-pt.created) +// + ". ConnectTime: " + (pt.connected > 0 ? Long.toString(pt.connected-pt.started) : "-") +// + ". Runtime: " + (pt.ended-pt.started) +// + ". Loops: " + pt.loops +// + ". State: " + pt.state +// + ". thrown: "+ pt.thrown +// ); +// } +// } assertEquals("WARNING: Expected half the threads to fail",pts.length/2,failed); } else { assertEquals("Did not expect any threads to fail",0,failed); @@ -780,11 +776,13 @@ private Throwable thrown; - private final long created; // When object was created - private long started; // when thread started - private long ended; // when thread ended - private long connected; // when thread last connected - private int loops = 0; + // Debug for DBCP-318 +// private final long created; // When object was created +// private long started; // when thread started +// private long ended; // when thread ended +// private long connected; // when thread last connected +// private int loops = 0; + private final boolean stopOnException; // If true, don't rethrow Exception private PoolTest(ThreadGroup threadGroup, int connHoldTime) { @@ -799,7 +797,7 @@ thread = new Thread(threadGroup, this, "Thread+" + currentThreadCount++); thread.setDaemon(false); - created = System.currentTimeMillis(); +// created = System.currentTimeMillis(); } public void start(){ @@ -807,13 +805,13 @@ } public void run() { - started = System.currentTimeMillis(); +// started = System.currentTimeMillis(); try { while (isRun) { - loops++; +// loops++; state = "Getting Connection"; Connection conn = getConnection(); - connected = System.currentTimeMillis(); +// connected = System.currentTimeMillis(); state = "Using Connection"; assertNotNull(conn); PreparedStatement stmt = @@ -839,7 +837,7 @@ throw new RuntimeException(); } } finally { - ended = System.currentTimeMillis(); +// ended = System.currentTimeMillis(); } }