incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r938228 - /sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java
Date Mon, 26 Apr 2010 20:42:25 GMT
Author: fmeschbe
Date: Mon Apr 26 20:42:25 2010
New Revision: 938228

URL: http://svn.apache.org/viewvc?rev=938228&view=rev
Log:
FELIX-1502 Synchronize access to consumers set

Modified:
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java

Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java?rev=938228&r1=938227&r2=938228&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java
Mon Apr 26 20:42:25 2010
@@ -57,14 +57,17 @@ public class AccessManagerFactoryTracker
     public void removedService(ServiceReference serviceReference, Object o) {
         log.warn("AccessManager service removed.");
         this.factory = null;
-        // Make a copy of consumers list to avoid concurrent modification
         closeSessions();
         super.removedService(serviceReference, o);
     }
 
     private void closeSessions() {
         log.warn("Closing all sessions");
-        Set<PluggableDefaultAccessManager> closing = new HashSet<PluggableDefaultAccessManager>(consumers);
+        // Make a copy of consumers list to avoid concurrent modification
+        Set<PluggableDefaultAccessManager> closing;
+        synchronized (consumers) {
+            closing = new HashSet<PluggableDefaultAccessManager>(consumers);
+        }
         for (PluggableDefaultAccessManager consumer : closing) {
             try {
                 consumer.endSession();
@@ -83,12 +86,16 @@ public class AccessManagerFactoryTracker
 
     public AccessManagerPluginFactory getFactory(PluggableDefaultAccessManager consumer)
{
         log.debug("Registering PluggableDefaultAccessManager instance");
-        this.consumers.add(consumer);
+        synchronized (consumers) {
+            this.consumers.add(consumer);
+        }
         return factory;
     }
 
     public void unregister(PluggableDefaultAccessManager consumer) {
         log.debug("Unregistering PluggableDefaultAccessManager instance");
-        this.consumers.remove(consumer);
+        synchronized (consumers) {
+            this.consumers.remove(consumer);
+        }
     }
 }



Mime
View raw message