jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sch...@apache.org
Subject svn commit: r1368903 - in /jackrabbit/branches/2.4: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
Date Fri, 03 Aug 2012 11:56:31 GMT
Author: schans
Date: Fri Aug  3 11:56:31 2012
New Revision: 1368903

URL: http://svn.apache.org/viewvc?rev=1368903&view=rev
Log:
JCR-3353: Backport: prevent deadlock during unlocking of the journal

Modified:
    jackrabbit/branches/2.4/   (props changed)
    jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
    jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java

Propchange: jackrabbit/branches/2.4/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1352440

Modified: jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java?rev=1368903&r1=1368902&r2=1368903&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
Fri Aug  3 11:56:31 2012
@@ -326,9 +326,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/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java?rev=1368903&r1=1368902&r2=1368903&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
(original)
+++ jackrabbit/branches/2.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelper.java
Fri Aug  3 11:56:31 2012
@@ -258,7 +258,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