commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r899018 - /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
Date Thu, 14 Jan 2010 01:18:57 GMT
Author: sebb
Date: Thu Jan 14 01:18:57 2010
New Revision: 899018

URL: http://svn.apache.org/viewvc?rev=899018&view=rev
Log:
Try to check which connection is actually reused.

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=899018&r1=899017&r2=899018&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 Thu
Jan 14 01:18:57 2010
@@ -783,6 +783,7 @@
                                     + ". Post: " + (pt.postconnected != 0 ? Long.toString(pt.postconnected-offset):
"-")
                                     + ". Startup: " + (pt.started-pt.created)
                                     + ". getConn(): " + (pt.connected != 0 ? Long.toString(pt.connected-pt.preconnected)
: "-")
+                                    + ". Hash: " + pt.connHash
                                     + ". Runtime: " + (pt.ended-pt.started)
                                     + ". IDX: " + i
                                     + ". Loops: " + pt.loops
@@ -829,6 +830,7 @@
         private long connected; // when thread last connected
         private long postconnected; // when thread released connection
         private int loops = 0;
+        private int connHash = 0; // Connection identity hashCode (to see which one is reused)
 
         private final boolean stopOnException; // If true, don't rethrow Exception
         
@@ -862,6 +864,7 @@
                     state = "Getting Connection";
                     preconnected = timeStamp();
                     Connection conn = getConnection();
+                    connHash = System.identityHashCode(conn);
                     connected = timeStamp();
                     state = "Using Connection";
                     assertNotNull(conn);



Mime
View raw message