Author: not
Date: Sat Jul 23 12:32:47 2011
New Revision: 1150095

URL: http://svn.apache.org/viewvc?rev=1150095&view=rev
Log:
ARIES-677 There were 3 places where services, references and beans were being 
"cleaned up" in the wrong order. This has been refactored to be in one place 
with the correct order.

Modified:
    
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java

Modified: 
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java?rev=1150095&r1=1150094&r2=1150095&view=diff
==============================================================================
--- 
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
 (original)
+++ 
aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
 Sat Jul 23 12:32:47 2011
@@ -208,9 +208,7 @@ public class BlueprintContainerImpl impl
     }
 
     public void reload() {
-        unregisterServices();
-        untrackServiceReferences();
-        destroyComponents();
+        tidyupComponents();
         this.componentDefinitionRegistry.reset();
         this.repository = null;
         this.processors = new ArrayList<Processor>();
@@ -290,9 +288,7 @@ public class BlueprintContainerImpl impl
                                     Throwable t = new TimeoutException();
                                     state = State.Failed;
                                     String[] missingDependecies = 
getMissingDependencies();
-                                    unregisterServices();
-                                    untrackServiceReferences();
-                                    destroyComponents();
+                                    tidyupComponents();
                                     LOGGER.error("Unable to start blueprint 
container for bundle " + bundleContext.getBundle().getSymbolicName() + " due to 
unresolved dependencies " + Arrays.asList(missingDependecies), t);
                                     eventDispatcher.blueprintEvent(new 
BlueprintEvent(BlueprintEvent.FAILURE, getBundleContext().getBundle(), 
getExtenderBundle(), missingDependecies, t));
                                 }
@@ -356,9 +352,7 @@ public class BlueprintContainerImpl impl
             if (timeoutFuture != null) {
                 timeoutFuture.cancel(false);
             }
-            unregisterServices();
-            untrackServiceReferences();
-            destroyComponents();
+            tidyupComponents();
             LOGGER.error("Unable to start blueprint container for bundle " + 
bundleContext.getBundle().getSymbolicName(), t);
             eventDispatcher.blueprintEvent(new 
BlueprintEvent(BlueprintEvent.FAILURE, getBundleContext().getBundle(), 
getExtenderBundle(), t));
         }
@@ -868,13 +862,18 @@ public class BlueprintContainerImpl impl
 
     public void namespaceHandlerUnregistered(URI uri) {
         if (namespaces != null && namespaces.contains(uri)) {
-            unregisterServices();
-            untrackServiceReferences();
-            destroyComponents();
+            tidyupComponents();
             state = State.WaitForNamespaceHandlers;
             schedule();
         }
     }
 
+    private void tidyupComponents()
+    {
+      unregisterServices();
+      destroyComponents();
+      untrackServiceReferences();
+    }
+
 }
 


Reply via email to