jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1040102 - in /jackrabbit/branches/2.1: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/FineGrainedISMLocking.java
Date Mon, 29 Nov 2010 13:12:05 GMT
Author: jukka
Date: Mon Nov 29 13:12:05 2010
New Revision: 1040102

URL: http://svn.apache.org/viewvc?rev=1040102&view=rev
Log:
2.1: Merged revision 1040090 (JCR-2820)

Modified:
    jackrabbit/branches/2.1/   (props changed)
    jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/FineGrainedISMLocking.java

Propchange: jackrabbit/branches/2.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 29 13:12:05 2010
@@ -2,4 +2,4 @@
 /jackrabbit/sandbox/JCR-1456:774917-886178
 /jackrabbit/sandbox/JCR-2170:812417-816332
 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863
-/jackrabbit/trunk:931121,931479,931483-931484,931504,931609,931613,931838,931919,932318-932319,933144,933197,933203,933213,933216,933554,933646,933694,934405,934412,934849,935557,936668,938099,945528,950440,950680,955222,955229,955307,955852,961487,961626,964362,965539,986682,986686,986715,991144,995411-995412,996810,999298-999299,999965,1000947,1001707,1002065-1002066,1002084,1002101-1002102,1002168,1002170,1002589,1002608,1002657,1002729,1003423,1003470,1003542,1003773,1004182,1004184,1004223-1004224,1004652,1005057,1005112,1036117,1036336-1036337,1038201,1039064
+/jackrabbit/trunk:931121,931479,931483-931484,931504,931609,931613,931838,931919,932318-932319,933144,933197,933203,933213,933216,933554,933646,933694,934405,934412,934849,935557,936668,938099,945528,950440,950680,955222,955229,955307,955852,961487,961626,964362,965539,986682,986686,986715,991144,995411-995412,996810,999298-999299,999965,1000947,1001707,1002065-1002066,1002084,1002101-1002102,1002168,1002170,1002589,1002608,1002657,1002729,1003423,1003470,1003542,1003773,1004182,1004184,1004223-1004224,1004652,1005057,1005112,1036117,1036336-1036337,1038201,1039064,1040090

Modified: jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/FineGrainedISMLocking.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/FineGrainedISMLocking.java?rev=1040102&r1=1040101&r2=1040102&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/FineGrainedISMLocking.java
(original)
+++ jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/FineGrainedISMLocking.java
Mon Nov 29 13:12:05 2010
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.core.state;
 
+import static org.apache.jackrabbit.core.TransactionContext.getCurrentThreadId;
+import static org.apache.jackrabbit.core.TransactionContext.isSameThreadId;
+
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -52,7 +55,7 @@ public class FineGrainedISMLocking imple
      */
     private WriteLockImpl activeWriter;
 
-    private volatile Thread activeWriterThread;
+    private volatile Object activeWriterId;
 
     private ReadWriteLock writerStateRWLock = new WriterPreferenceReadWriteLock();
 
@@ -79,7 +82,7 @@ public class FineGrainedISMLocking imple
      */
     public ReadLock acquireReadLock(ItemId id)
             throws InterruptedException {
-        if (activeWriterThread == Thread.currentThread()) {
+        if (isSameThreadId(activeWriterId, getCurrentThreadId())) {
             // we hold the write lock
             readLockMap.addLock(id);
             return new ReadLockImpl(id);
@@ -126,7 +129,7 @@ public class FineGrainedISMLocking imple
                 if (activeWriter == null
                         && !readLockMap.hasDependency(changeLog)) {
                     activeWriter = new WriteLockImpl(changeLog);
-                    activeWriterThread = Thread.currentThread();
+                    activeWriterId = getCurrentThreadId();
                     return activeWriter;
                 } else {
                     signal = new Latch();
@@ -164,7 +167,7 @@ public class FineGrainedISMLocking imple
             }
             try {
                 activeWriter = null;
-                activeWriterThread = null;
+                activeWriterId = null;
                 notifyWaitingReaders();
                 notifyWaitingWriters();
             } finally {
@@ -186,7 +189,6 @@ public class FineGrainedISMLocking imple
             }
             try {
                 activeWriter = null;
-                activeWriterThread = null;
                 // only notify waiting readers since we still hold a down
                 // graded lock, which is kind of exclusiv with respect to
                 // other writers
@@ -224,7 +226,7 @@ public class FineGrainedISMLocking imple
             }
             try {
                 readLockMap.removeLock(id);
-                if (activeWriterThread != Thread.currentThread()) {
+                if (!isSameThreadId(activeWriterId, getCurrentThreadId())) {
                     // only notify waiting writers if we do *not* hold a write
                     // lock at the same time. that would be a waste of cpu time.
                     notifyWaitingWriters();



Mime
View raw message