From 1182f46d8cad4f3e7e536281ca66ad574e34e762 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 30 Apr 2009 13:04:43 +0000 Subject: [PATCH] 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 --- src/helma/objectmodel/db/Transactor.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/helma/objectmodel/db/Transactor.java b/src/helma/objectmodel/db/Transactor.java index a8d457e6..5af1030a 100644 --- a/src/helma/objectmodel/db/Transactor.java +++ b/src/helma/objectmodel/db/Transactor.java @@ -254,7 +254,7 @@ public class Transactor { 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 @@ public class Transactor { dirtyNodes.clear(); cleanNodes.clear(); parentNodes.clear(); - testedConnections.clear(); txn = nmgr.db.beginTransaction(); active = true; tstart = System.currentTimeMillis(); @@ -542,6 +541,7 @@ public class Transactor { } sqlConnections.clear(); + testedConnections.clear(); } } @@ -555,7 +555,6 @@ public class Transactor { dirtyNodes.clear(); cleanNodes.clear(); parentNodes.clear(); - testedConnections.clear(); } /**