commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r896848 - /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
Date Thu, 07 Jan 2010 11:26:43 GMT
Author: sebb
Date: Thu Jan  7 11:26:05 2010
New Revision: 896848

URL: http://svn.apache.org/viewvc?rev=896848&view=rev
Log:
Re-enable DBCP-318 debug to help track Java 1.5 failures with same symptoms

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=896848&r1=896847&r2=896848&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  7 11:26:05 2010
@@ -740,19 +740,19 @@
                     // Perform initial sanity check:
                     assertTrue("Expected some of the threads to fail",failed > 0);
 // 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
-//                                    );
-//                        }                        
-//                    }
+                    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);
@@ -777,11 +777,11 @@
         private Throwable thrown;
 
         // 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 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
         
@@ -797,7 +797,7 @@
             thread =
                 new Thread(threadGroup, this, "Thread+" + currentThreadCount++);
             thread.setDaemon(false);
-//            created = System.currentTimeMillis();
+            created = System.currentTimeMillis();
         }
 
         public void start(){
@@ -805,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 =
@@ -837,7 +837,7 @@
                     throw new RuntimeException();
                 }
             } finally {
-//                ended = System.currentTimeMillis();                
+                ended = System.currentTimeMillis();                
             }
         }
 



Mime
View raw message