felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1492982 - /felix/trunk/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
Date Fri, 14 Jun 2013 07:44:19 GMT
Author: clement
Date: Fri Jun 14 07:44:18 2013
New Revision: 1492982

URL: http://svn.apache.org/r1492982
Log:
remove java 6 api usage

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=1492982&r1=1492981&r2=1492982&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
Fri Jun 14 07:44:18 2013
@@ -576,25 +576,23 @@ public abstract class DependencyModel {
 
     /**
      * Acquires the read lock only and only if no read lock is already held by the current
thread.
+     *
+     * As the introspection methods provided by this method are java 6+, we just take a read
lock.
      * @return {@literal true} if the lock was acquired within the method, {@literal false}
otherwise.
      */
     public boolean acquireReadLockIfNotHeld() {
-        if (m_lock.getReadHoldCount() == 0) {
-            m_lock.readLock().lock();
-            return true;
-        }
-        return false;
+        m_lock.readLock().lock();
+        return true;
     }
 
     /**
      * Releases the read lock only and only if the read lock is held by the current thread.
+     * * As the introspection methods provided by this method are java 6+, we just unlock
the read lock.
      * @return {@literal true} if the lock has no more holders, {@literal false} otherwise.
      */
     public boolean releaseReadLockIfHeld() {
-        if (m_lock.getReadHoldCount() > 0) {
-            m_lock.readLock().unlock();
-        }
-        return m_lock.getWriteHoldCount() == 0;
+        m_lock.readLock().unlock();
+        return true;
     }
 
     /**



Mime
View raw message