Author: cziegeler
Date: Fri Feb 21 13:12:33 2014
New Revision: 1570565

URL: http://svn.apache.org/r1570565
Log:
SLING-3400 : Sling holds resource providers after they have been unregistered

Modified:
    
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java

Modified: 
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java?rev=1570565&r1=1570564&r2=1570565&view=diff
==============================================================================
--- 
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
 (original)
+++ 
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverFactoryActivator.java
 Fri Feb 21 13:12:33 2014
@@ -187,7 +187,7 @@ public class ResourceResolverFactoryActi
               description = "This flag controls whether all resources with a 
sling:vanityPath property " +
                             "are processed and added to the mappoing table.")
     private static final String PROP_ENABLE_VANITY_PATH = 
"resource.resolver.enable.vanitypath";
-    
+
     private static final boolean DEFAULT_ENABLE_OPTIMIZE_ALIAS_RESOLUTION = 
true;
     @Property(boolValue = DEFAULT_ENABLE_OPTIMIZE_ALIAS_RESOLUTION ,
               label = "Optimize alias resolution",
@@ -265,7 +265,7 @@ public class ResourceResolverFactoryActi
 
     /** vanityPath enabled? */
     private boolean enableVanityPath = DEFAULT_ENABLE_VANITY_PATH;
-    
+
     /** alias resource resolution optimization enabled? */
     private boolean enableOptimizeAliasResolution = 
DEFAULT_ENABLE_OPTIMIZE_ALIAS_RESOLUTION;
 
@@ -337,7 +337,7 @@ public class ResourceResolverFactoryActi
     public boolean isVanityPathEnabled() {
         return this.enableVanityPath;
     }
-    
+
     public boolean isOptimizeAliasResolutionEnabled() {
         return this.enableOptimizeAliasResolution;
     }
@@ -405,7 +405,7 @@ public class ResourceResolverFactoryActi
         defaultVanityPathRedirectStatus = 
PropertiesUtil.toInteger(properties.get(PROP_DEFAULT_VANITY_PATH_REDIRECT_STATUS),
                                                                    
MapEntries.DEFAULT_DEFAULT_VANITY_PATH_REDIRECT_STATUS);
         this.enableVanityPath = 
PropertiesUtil.toBoolean(properties.get(PROP_ENABLE_VANITY_PATH), 
DEFAULT_ENABLE_VANITY_PATH);
-        
+
         this.enableOptimizeAliasResolution = 
PropertiesUtil.toBoolean(properties.get(PROP_ENABLE_OPTIMIZE_ALIAS_RESOLUTION), 
DEFAULT_ENABLE_OPTIMIZE_ALIAS_RESOLUTION);
 
         final BundleContext bc = componentContext.getBundleContext();
@@ -473,7 +473,6 @@ public class ResourceResolverFactoryActi
 
         if ( local != null ) {
             // activate and register factory
-
             final Dictionary<String, Object> serviceProps = new 
Hashtable<String, Object>();
             serviceProps.put(Constants.SERVICE_VENDOR, 
localContext.getProperties().get(Constants.SERVICE_VENDOR));
             serviceProps.put(Constants.SERVICE_DESCRIPTION, 
localContext.getProperties().get(Constants.SERVICE_DESCRIPTION));
@@ -557,6 +556,14 @@ public class ResourceResolverFactoryActi
         this.rootProviderEntry.unbindResourceProviderFactory(provider, props);
         this.preconds.unbindProvider(props);
         this.checkFactoryPreconditions();
+        boolean unregister = false;
+        synchronized ( this ) {
+            unregister = this.factoryRegistration != null;
+        }
+        if (unregister ) {
+            this.unregisterFactory();
+            this.checkFactoryPreconditions();
+        }
     }
 
     /**


Reply via email to