incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1041609 - /incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java
Date Thu, 02 Dec 2010 22:11:19 GMT
Author: not
Date: Thu Dec  2 22:11:19 2010
New Revision: 1041609

URL: http://svn.apache.org/viewvc?rev=1041609&view=rev
Log:
Add some comments around the locking.

Modified:
    incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java

Modified: incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java?rev=1041609&r1=1041608&r2=1041609&view=diff
==============================================================================
--- incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java
(original)
+++ incubator/aries/trunk/util/src/main/java/org/apache/aries/util/SingleServiceTracker.java
Thu Dec  2 22:11:19 2010
@@ -115,10 +115,13 @@ public final class SingleServiceTracker<
     // Make sure we don't try to get a lock on null
     Object lock;
     
+    // we have to choose our lock.
     if (newRef != null) lock = newRef;
     else if (deadRef != null) lock = deadRef;
     else lock = this;
     
+    // This lock is here to ensure that no two threads can set the ref and service
+    // at the same time. 
     synchronized (lock) {
       if (open.get()) {
         result = this.ref.compareAndSet(deadRef, newRef);



Mime
View raw message