You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2010/02/12 17:33:02 UTC
svn commit: r909494 -
/felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java
Author: gnodet
Date: Fri Feb 12 16:33:02 2010
New Revision: 909494
URL: http://svn.apache.org/viewvc?rev=909494&view=rev
Log:
FELIX-2072: OracleJDBCLock filling UNDO segment
Modified:
felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java
Modified: felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java?rev=909494&r1=909493&r2=909494&view=diff
==============================================================================
--- felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java (original)
+++ felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/OracleJDBCLock.java Fri Feb 12 16:33:02 2010
@@ -129,6 +129,8 @@
result = statement.execute();
} catch (Exception e) {
LOG.warning("Could not obtain connection: " + e.getMessage());
+ lockConnection.close();
+ lockConnection = null;
} finally {
if (null != statement) {
try {
@@ -157,14 +159,10 @@
LOG.severe("Could not set DB update cursor");
return result;
}
- LOG.fine("OracleJDBCLock#lock:: have set Update Cursor, now do update");
- long time = System.currentTimeMillis();
- statement = lockConnection.prepareStatement(statements.getLockUpdateStatement(time));
- int rows = statement.executeUpdate();
- LOG.fine("OracleJDBCLock#lock:: Number of update rows: " + rows);
- if (rows >= 1) {
- result=true;
- }
+ LOG.fine("OracleJDBCLock#lock:: have set Update Cursor, now perform query");
+ String up = "SELECT * FROM " + table;
+ statement = lockConnection.prepareStatement(up);
+ return statement.execute();
} catch (Exception e) {
LOG.warning("Failed to acquire database lock: " + e.getMessage());
}finally {
@@ -198,28 +196,7 @@
LOG.severe("Lost lock!");
return false;
}
- PreparedStatement statement = null;
- boolean result = true;
- try {
- long time = System.currentTimeMillis();
- statement = lockConnection.prepareStatement(statements.getLockUpdateStatement(time));
- int rows = statement.executeUpdate();
- if (rows < 1) {
- result = false;
- }
- } catch (Exception ex) {
- LOG.severe("Error occured while testing lock: " + ex + " " + ex.getMessage());
- return false;
- } finally {
- if (statement != null) {
- try {
- statement.close();
- } catch (Exception ex1) {
- LOG.severe("Error occured after testing lock: " + ex1.getMessage());
- }
- }
- }
- return result;
+ return true;
}
/**