servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r1400079 - in /servicemix/smx4/nmr/trunk/nmr: core/src/main/java/org/apache/servicemix/nmr/core/ServiceMix.java osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml
Date Fri, 19 Oct 2012 13:04:27 GMT
Author: gertv
Date: Fri Oct 19 13:04:26 2012
New Revision: 1400079

URL: http://svn.apache.org/viewvc?rev=1400079&view=rev
Log:
SMX4NMR-302: Make sure the nmr-osgi bundle can be stopped after the nmr-management bundle

Modified:
    servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceMix.java
    servicemix/smx4/nmr/trunk/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml

Modified: servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceMix.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceMix.java?rev=1400079&r1=1400078&r2=1400079&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceMix.java
(original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceMix.java
Fri Oct 19 13:04:26 2012
@@ -194,10 +194,14 @@ public class ServiceMix implements NMR {
      *
      * @param managementStrategy the management strategy
      */
-    public void setManagementStrategy(ManagementStrategy managementStrategy) {
+    public void bindManagementStrategy(ManagementStrategy managementStrategy) {
         this.managementStrategy = managementStrategy;
     }
 
+    public void unbindManagementStrategy(ManagementStrategy ms) {
+        managementStrategy = null;
+    }
+
     /**
      * Access the NMR id
      *
@@ -227,7 +231,10 @@ public class ServiceMix implements NMR {
 
     private void fireEvent(EventObject event) {
         try {
-            getManagementStrategy().notify(event);
+            ManagementStrategy ms = getManagementStrategy();
+            if (ms != null) {
+                ms.notify(event);
+            }
         } catch (Exception e) {
             // ignore
         }

Modified: servicemix/smx4/nmr/trunk/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml?rev=1400079&r1=1400078&r2=1400079&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml
(original)
+++ servicemix/smx4/nmr/trunk/nmr/osgi/src/main/resources/OSGI-INF/blueprint/servicemix-nmr.xml
Fri Oct 19 13:04:26 2012
@@ -35,13 +35,14 @@
         <property name="flowRegistry" ref="flowRegistry"/>
         <property name="wireRegistry" ref="wireRegistry"/>
         <property name="executorFactory" ref="executorFactory"/>
-        <property name="managementStrategy" ref="managementStrategy"/>
         <property name="id" value="${nmrId}"/>
     </bean>
     <service ref="servicemix" interface="org.apache.servicemix.nmr.api.NMR"/>
 
     <!-- Retrieve ManagementStrategy from OSGi service registry -->
-    <reference id="managementStrategy" interface="org.fusesource.commons.management.ManagementStrategy"/>
+    <reference id="managementStrategy" interface="org.fusesource.commons.management.ManagementStrategy">
+        <reference-listener ref="servicemix" bind-method="bindManagementStrategy" unbind-method="unbindManagementStrategy"
/>
+    </reference>
 
     <!-- Flow registry and service tracker -->
     <bean id="flowRegistry" class="org.apache.servicemix.nmr.core.FlowRegistryImpl">



Mime
View raw message