commit | 928ea525791dd2712184aaf21a25e847987f6aa0 | [log] [tgz] |
---|---|---|
author | Guillaume Nodet <gnodet@apache.org> | Fri Apr 30 08:31:53 2010 +0000 |
committer | Guillaume Nodet <gnodet@apache.org> | Fri Apr 30 08:31:53 2010 +0000 |
tree | b8be0521b0d119c26bdedb0f3cd53c2f5022acbb | |
parent | f7708f7806d6bd424d42f286c7b4a9e4db7cf5a1 [diff] |
FELIX-2130: Karaf] Failover Clustering Mechanism - Database shutdown / loss results in all Karaf instances becoming Active on restart of that DB git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@939585 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/main/src/main/java/org/apache/felix/karaf/main/Main.java b/karaf/main/src/main/java/org/apache/felix/karaf/main/Main.java index 663a399..9020673 100644 --- a/karaf/main/src/main/java/org/apache/felix/karaf/main/Main.java +++ b/karaf/main/src/main/java/org/apache/felix/karaf/main/Main.java
@@ -1084,7 +1084,6 @@ LOG.info("Lost the lock, stopping this instance ..."); setStartLevel(lockStartLevel); } - break; } else if (!lockLogged) { LOG.info("Waiting for the lock ..."); lockLogged = true;
diff --git a/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java b/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java index 1106f74..ff9b9cb 100644 --- a/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java +++ b/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java
@@ -196,7 +196,23 @@ LOG.severe("Lost lock!"); return false; } - return true; + PreparedStatement statement = null; + try { + String up = "SELECT * FROM " + table; + statement = lockConnection.prepareStatement(up); + return statement.execute(); + } catch (Exception e) { + LOG.warning("Failed to access database. " + e.getMessage()); + } finally { + if (statement != null) { + try { + statement.close(); + } catch (SQLException e) { + LOG.severe("Failed to close statement" + e); + } + } + } + return false; } /**