jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r1352440 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: journal/AbstractJournal.java util/db/ConnectionHelper.java
Date Thu, 21 Jun 2012 07:59:47 GMT
Author: ckoell
Date: Thu Jun 21 07:59:47 2012
New Revision: 1352440

URL: http://svn.apache.org/viewvc?rev=1352440&view=rev
Log:
JCR-3353 A DeadLock can occur if an Exception is thrown while unlocking the Journal

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java?rev=1352440&r1=1352439&r2=1352440&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
Thu Jun 21 07:59:47 2012
@@ -327,9 +327,13 @@ public abstract class AbstractJournal im
      *                   successful
      */
     public void unlock(boolean successful) {
-        doUnlock(successful);
-
-        rwLock.writeLock().release();
+    	try {
+    		doUnlock(successful);
+    	} finally {
+    		//Should not happen that a RuntimeException will be thrown in subCode, but it's safer
+    		//to release the rwLock in finally block.
+            rwLock.writeLock().release();
+    	}
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java?rev=1352440&r1=1352439&r2=1352440&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
Thu Jun 21 07:59:47 2012
@@ -253,7 +253,7 @@ public class ConnectionHelper {
      */
     public final void endBatch(boolean commit) throws SQLException {
         if (!inBatchMode()) {
-            throw new IllegalStateException("not in batch mode");
+            throw new SQLException("not in batch mode");
         }
         try {
             if (commit) {



Mime
View raw message