summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2014-10-12 18:16:38 +0200
committerDavid A. Madore <david+git@madore.org>2014-10-12 18:16:38 +0200
commitc0ede89351958fba8c5112fd4c8fbf0fc17e8e12 (patch)
tree23f3d6e9c304f1fc1e0ba3b43daef8c62a1601c6
parent4e7ceb1dde219d03e577c7c038e19f977c9abc29 (diff)
downloaddamlengine-c0ede89351958fba8c5112fd4c8fbf0fc17e8e12.tar.gz
damlengine-c0ede89351958fba8c5112fd4c8fbf0fc17e8e12.tar.bz2
damlengine-c0ede89351958fba8c5112fd4c8fbf0fc17e8e12.zip
Check whether database connection is still open.
Note, however, that a real check needs to use .isValid() which is only available starting from JDBC4. So, we need to move up to this.
-rw-r--r--org/madore/damlengine/WeblogDatabaseConnection.java2
-rw-r--r--org/madore/damlengine/WeblogServlet.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/org/madore/damlengine/WeblogDatabaseConnection.java b/org/madore/damlengine/WeblogDatabaseConnection.java
index 16d0973..dfacebb 100644
--- a/org/madore/damlengine/WeblogDatabaseConnection.java
+++ b/org/madore/damlengine/WeblogDatabaseConnection.java
@@ -21,7 +21,7 @@ public final class WeblogDatabaseConnection {
public static Connection getConnection()
throws SQLException {
Connection conn = pconn.get();
- if ( conn == null ) {
+ if ( conn == null || conn.isClosed() ) {
String dbHost = null;
if ( ! DamlEngine.runAsServlet )
dbHost = System.getenv("DAMLENGINE_PGHOST");
diff --git a/org/madore/damlengine/WeblogServlet.java b/org/madore/damlengine/WeblogServlet.java
index c5ace1f..0e0ebe4 100644
--- a/org/madore/damlengine/WeblogServlet.java
+++ b/org/madore/damlengine/WeblogServlet.java
@@ -34,7 +34,7 @@ import javax.servlet.http.HttpServletResponse;
public class WeblogServlet extends HttpServlet {
- private static final long serialVersionUID = 2014101201L;
+ private static final long serialVersionUID = 2014101202L;
@Override
public void init(ServletConfig cfg)