jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r657031 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: state/DefaultISMLocking.java state/SharedItemStateManager.java version/XAVersionManager.java
Date Fri, 16 May 2008 12:25:36 GMT
Author: mreutegg
Date: Fri May 16 05:25:36 2008
New Revision: 657031

URL: http://svn.apache.org/viewvc?rev=657031&view=rev
Log:
JCR-1600: Remove noLockHack in SharedItemStateManager

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/DefaultISMLocking.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.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=657031&r1=657030&r2=657031&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
Fri May 16 05:25:36 2008
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.core.state;
 
 import org.apache.jackrabbit.core.ItemId;
-import EDU.oswego.cs.dl.util.concurrent.ReadWriteLock;
 import EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock;
 import EDU.oswego.cs.dl.util.concurrent.Sync;
 
@@ -29,33 +28,9 @@
 public class DefaultISMLocking implements ISMLocking {
 
     /**
-     * JCR-447: deadlock might occur when this manager is still write-locked and events are
dispatched.
-     */
-    private boolean noLockHack = false;
-
-    /**
      * The internal read-write lock.
      */
-    private final ReadWriteLock rwLock = new 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()
-                    || noLockHack;
-        }
-    };
-
-    /**
-     * enables or disables the write-lock hack.
-     *
-     * @param noLockHack
-     */
-    public void setNoLockHack(boolean noLockHack) {
-        this.noLockHack = noLockHack;
-    }
+    private final RWLock rwLock = new RWLock();
 
     /**
      * {@inheritDoc}
@@ -110,4 +85,16 @@
             readLock.release();
         }
     }
+
+    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();
+        }
+    }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=657031&r1=657030&r2=657031&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Fri May 16 05:25:36 2008
@@ -216,18 +216,6 @@
     }
 
     /**
-     * enables or disables the write-lock hack. this should only be called by
-     * the {@link XAVersionManager}.
-     *
-     * @param noLockHack
-     */
-    public void setNoLockHack(boolean noLockHack) {
-        if (ismLocking instanceof DefaultISMLocking) {
-            ((DefaultISMLocking) ismLocking).setNoLockHack(noLockHack);
-        }
-    }
-
-    /**
      * Set an update event channel
      *
      * @param eventChannel update event channel

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java?rev=657031&r1=657030&r2=657031&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
Fri May 16 05:25:36 2008
@@ -521,7 +521,6 @@
                 Map vItems = (Map) tx.getAttribute(ITEMS_ATTRIBUTE_NAME);
                 if (!vItems.isEmpty()) {
                     vMgr.acquireWriteLock();
-                    vMgr.getSharedStateMgr().setNoLockHack(true);
                     vmgrLocked = true;
                 }
             }
@@ -568,7 +567,6 @@
 
             private void internalReleaseWriteLock() {
                 if (vmgrLocked) {
-                    vMgr.getSharedStateMgr().setNoLockHack(false);
                     vMgr.releaseWriteLock();
                     vmgrLocked = false;
                 }



Mime
View raw message