jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r923597 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/DefaultISMLocking.java
Date Tue, 16 Mar 2010 07:30:26 GMT
Author: ckoell
Date: Tue Mar 16 07:30:26 2010
New Revision: 923597

URL: http://svn.apache.org/viewvc?rev=923597&view=rev
Log:
JCR-2554 Deadlock inside XASession on Weblogic (Writer Preference)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/DefaultISMLocking.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/DefaultISMLocking.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/DefaultISMLocking.java?rev=923597&r1=923596&r2=923597&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/DefaultISMLocking.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/DefaultISMLocking.java
Tue Mar 16 07:30:26 2010
@@ -36,8 +36,9 @@ public class DefaultISMLocking implement
 
     /**
      * The internal read-write lock.
+	 * Thread concerning ReentrantWriterPreferenceReadWriteLock
      */
-    private final ReadWriteLock rwLock = new RWLock();
+    private final ReadWriteLock rwLock = new ReentrantWriterPreferenceReadWriteLock();
     
     /**
      * The internal Xid aware read-write lock.
@@ -110,20 +111,6 @@ public class DefaultISMLocking implement
     }
 
 	/**
-	 * Thread concerning ReentrantWriterPreferenceReadWriteLock
-	 */
-    private static final class RWLock extends ReentrantWriterPreferenceReadWriteLock {
-
-    	/**
-         * Allow reader when there is no active writer, or current thread owns
-         * the write lock (reentrant).
-         */
-        protected boolean allowReader() {
-            return activeWriter_ == null || activeWriter_ == Thread.currentThread();
-        }
-    }
-
-	/**
 	 * Xid concerning ReentrantWriterPreferenceReadWriteLock
 	 */
     private static final class XidRWLock extends ReentrantWriterPreferenceReadWriteLock {
@@ -145,7 +132,7 @@ public class DefaultISMLocking implement
          */
         protected boolean allowReader() {
         	Xid currentXid = TransactionContext.getCurrentXid();
-        	return activeXid == null || isSameGlobalTx(currentXid);
+        	return (activeXid == null && waitingWriters_ == 0) || isSameGlobalTx(currentXid);
         }
 
         /**



Mime
View raw message