incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1142570 - /sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java
Date Mon, 04 Jul 2011 07:04:03 GMT
Author: cziegeler
Date: Mon Jul  4 07:04:02 2011
New Revision: 1142570

URL: http://svn.apache.org/viewvc?rev=1142570&view=rev
Log:
SLING-2122 : SynchronousBundleListener might be called concurrently

Modified:
    sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java

Modified: sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java?rev=1142570&r1=1142569&r2=1142570&view=diff
==============================================================================
--- sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java
(original)
+++ sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java
Mon Jul  4 07:04:02 2011
@@ -108,18 +108,20 @@ public class Activator implements Synchr
      * @see org.osgi.framework.BundleListener#bundleChanged(org.osgi.framework.BundleEvent)
      */
     public void bundleChanged(BundleEvent event) {
-        final boolean reload;
-        if ( event.getType() == BundleEvent.RESOLVED ) {
-            reload = this.service.isBundleUsed(event.getBundle().getBundleId())
-                || this.service.hasUnresolvedPackages(event.getBundle());
-        } else if ( event.getType() == BundleEvent.UNRESOLVED ) {
-            reload = this.service.isBundleUsed(event.getBundle().getBundleId());
-        } else {
-            reload = false;
-        }
-        if ( reload ) {
-            this.unregisterManagerFactory();
-            this.registerManagerFactory();
+        synchronized ( this ) {
+            final boolean reload;
+            if ( event.getType() == BundleEvent.RESOLVED ) {
+                reload = this.service.isBundleUsed(event.getBundle().getBundleId())
+                    || this.service.hasUnresolvedPackages(event.getBundle());
+            } else if ( event.getType() == BundleEvent.UNRESOLVED ) {
+                reload = this.service.isBundleUsed(event.getBundle().getBundleId());
+            } else {
+                reload = false;
+            }
+            if ( reload ) {
+                this.unregisterManagerFactory();
+                this.registerManagerFactory();
+            }
         }
     }
 }



Mime
View raw message