r9693 - helma/helma/trunk/src/helma/objectmodel/db

[email protected] Thu, 30 Apr 2009 15:04:43 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090430130443.510843D0D6@mia>
Author: hannes
Date: 2009-04-30 15:04:43 +0200 (Thu, 30 Apr 2009)
New Revision: 9693

Modified:
   helma/helma/trunk/src/helma/objectmodel/db/Transactor.java
Log:
Make sure database connections are tested at most every 60 seconds by retaining connection test status across requests. Fixes bug 622 http://dev.helma.org/bugs/show_bug.cgi?id=662

Details at http://dev.helma.org/trac/helma/changeset/9693

Modified: helma/helma/trunk/src/helma/objectmodel/db/Transactor.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/Transactor.java	2009-04-29 17:31:23 UTC (rev 9692)
+++ helma/helma/trunk/src/helma/objectmodel/db/Transactor.java	2009-04-30 13:04:43 UTC (rev 9693)
@@ -254,7 +254,7 @@
         Connection con = (Connection) sqlConnections.get(src);
         Long tested = (Long) testedConnections.get(src);
         long now = System.currentTimeMillis();
-        if (con != null && (tested == null || now - tested.longValue() > 10000)) {
+        if (con != null && (tested == null || now - tested.longValue() > 60000)) {
             // Check if the connection is still alive by executing a simple statement.
             try {
                 Statement stmt = con.createStatement();
@@ -289,7 +289,6 @@
         dirtyNodes.clear();
         cleanNodes.clear();
         parentNodes.clear();
-        testedConnections.clear();
         txn = nmgr.db.beginTransaction();
         active = true;
         tstart = System.currentTimeMillis();
@@ -542,6 +541,7 @@
             }
 
             sqlConnections.clear();
+            testedConnections.clear();
         }
     }
 
@@ -555,7 +555,6 @@
         dirtyNodes.clear();
         cleanNodes.clear();
         parentNodes.clear();
-        testedConnections.clear();
     }
 
     /**