You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2010/01/15 12:22:04 UTC

svn commit: r899599 - /tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java

Author: slaws
Date: Fri Jan 15 11:22:04 2010
New Revision: 899599

URL: http://svn.apache.org/viewvc?rev=899599&view=rev
Log:
Fix to make OTEST JCA_2005 work again. This is an @EagerInit scenario and out code was starting scope containers before all endpoints had been registered. With all matching going through the binding/registry now this meant that the reference being used inside the @EagerInit failed to resolve. This change moves the scope container start to after the services are registered. 

Modified:
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java?rev=899599&r1=899598&r2=899599&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java Fri Jan 15 11:22:04 2010
@@ -299,6 +299,12 @@
         for (Component component : composite.getComponents()) {
             start(compositeContext, component);
         }
+        
+        for (Component component : composite.getComponents()) {
+            if (component instanceof ScopedRuntimeComponent) {
+                start(compositeContext, (ScopedRuntimeComponent)component);
+            }
+        }
     }
 
     public void stop(CompositeContext compositeContext, Composite composite) {
@@ -336,13 +342,8 @@
             }
         }
 
-        if (component instanceof ScopedRuntimeComponent) {
-            ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
-            if (scopedRuntimeComponent.getScopeContainer() != null) {
-                scopedRuntimeComponent.getScopeContainer().start();
-            }
-        }
-        // Reference bindings aren't started until the wire is first used
+        // Reference bindings aren't started until the wire is first used although this may
+        // happen when the scope container is started in the case of @EagerInit
 
         for (ComponentService service : component.getServices()) {
             if (logger.isLoggable(Level.FINE)) {
@@ -369,6 +370,7 @@
                 }
             }
         }
+               
 
         runtimeComponent.setStarted(true);
     }
@@ -456,6 +458,15 @@
         ((RuntimeComponent)component).setStarted(false);
     }
 
+    // Scope container start/stop
+    // separate off from component start that all endpoints are 
+    // registered before any @EagerInit takes place
+    public void start(CompositeContext compositeContext, ScopedRuntimeComponent scopedRuntimeComponent) {
+        if (scopedRuntimeComponent.getScopeContainer() != null) {
+            scopedRuntimeComponent.getScopeContainer().start();
+        }
+    }
+    
     // Service start/stop
 
     // done as part of the component start above