felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1492736 - /felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
Date Thu, 13 Jun 2013 16:18:12 GMT
Author: clement
Date: Thu Jun 13 16:18:12 2013
New Revision: 1492736

URL: http://svn.apache.org/r1492736
Log:
Fix locking issue

Modified:
    felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java

Modified: felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java?rev=1492736&r1=1492735&r2=1492736&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
(original)
+++ felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
Thu Jun 13 16:18:12 2013
@@ -579,8 +579,8 @@ public abstract class DependencyModel {
      * @return {@literal true} if the lock was acquired within the method, {@literal false}
otherwise.
      */
     public boolean acquireReadLockIfNotHeld() {
-        if (! m_lock.isWriteLockedByCurrentThread()) {
-            m_lock.writeLock().lock();
+        if (m_lock.getReadHoldCount() == 0) {
+            m_lock.readLock().lock();
             return true;
         }
         return false;
@@ -591,8 +591,8 @@ public abstract class DependencyModel {
      * @return {@literal true} if the lock has no more holders, {@literal false} otherwise.
      */
     public boolean releaseReadLockIfHeld() {
-        if (m_lock.isWriteLockedByCurrentThread()) {
-            m_lock.writeLock().unlock();
+        if (m_lock.getReadHoldCount() > 0) {
+            m_lock.readLock().unlock();
         }
         return m_lock.getWriteHoldCount() == 0;
     }



Mime
View raw message