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
This commit is contained in:
parent
9c123b41e9
commit
1182f46d8c
1 changed files with 2 additions and 3 deletions
|
@ -254,7 +254,7 @@ public class Transactor {
|
||||||
Connection con = (Connection) sqlConnections.get(src);
|
Connection con = (Connection) sqlConnections.get(src);
|
||||||
Long tested = (Long) testedConnections.get(src);
|
Long tested = (Long) testedConnections.get(src);
|
||||||
long now = System.currentTimeMillis();
|
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.
|
// Check if the connection is still alive by executing a simple statement.
|
||||||
try {
|
try {
|
||||||
Statement stmt = con.createStatement();
|
Statement stmt = con.createStatement();
|
||||||
|
@ -289,7 +289,6 @@ public class Transactor {
|
||||||
dirtyNodes.clear();
|
dirtyNodes.clear();
|
||||||
cleanNodes.clear();
|
cleanNodes.clear();
|
||||||
parentNodes.clear();
|
parentNodes.clear();
|
||||||
testedConnections.clear();
|
|
||||||
txn = nmgr.db.beginTransaction();
|
txn = nmgr.db.beginTransaction();
|
||||||
active = true;
|
active = true;
|
||||||
tstart = System.currentTimeMillis();
|
tstart = System.currentTimeMillis();
|
||||||
|
@ -542,6 +541,7 @@ public class Transactor {
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlConnections.clear();
|
sqlConnections.clear();
|
||||||
|
testedConnections.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,7 +555,6 @@ public class Transactor {
|
||||||
dirtyNodes.clear();
|
dirtyNodes.clear();
|
||||||
cleanNodes.clear();
|
cleanNodes.clear();
|
||||||
parentNodes.clear();
|
parentNodes.clear();
|
||||||
testedConnections.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue