servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r427935 - in /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi: framework/DeploymentService.java management/BaseSystemService.java management/ManagementContext.java
Date Wed, 02 Aug 2006 09:10:28 GMT
Author: aco
Date: Wed Aug  2 02:10:28 2006
New Revision: 427935

URL: http://svn.apache.org/viewvc?rev=427935&view=rev
Log:
Fix for javax.management.InstanceNotFoundException when shutting down system services. refer
to LBFUSE-283
- Added an unregisterSystemService to properly unregister SM system services.

Minor fixes.
- Remove unnecessary null checking in DeploymentService.java
- Called super.init in BaseSystemService.java to update the state of the bean

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseSystemService.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java?rev=427935&r1=427934&r2=427935&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
Wed Aug  2 02:10:28 2006
@@ -233,18 +233,18 @@
                 sa.shutDown();
             } catch (Exception e) {
             }
+
             String result = null;
-            if (sa != null) {
-                String assemblyName = sa.getName();
-                registry.unregisterServiceAssembly(assemblyName);
-                ServiceUnitLifeCycle[] sus = sa.getDeployedSUs();
-                if (sus != null) {
-                    for (int i = 0;i < sus.length; i++) {
-                        undeployServiceUnit(sus[i]);
-                    }
+            String assemblyName = sa.getName();
+            registry.unregisterServiceAssembly(assemblyName);
+            ServiceUnitLifeCycle[] sus = sa.getDeployedSUs();
+            if (sus != null) {
+                for (int i = 0;i < sus.length; i++) {
+                    undeployServiceUnit(sus[i]);
                 }
-                FileUtil.deleteFile(sa.getEnvironment().getRootDir());
             }
+            FileUtil.deleteFile(sa.getEnvironment().getRootDir());
+
             return result;
         } catch (Exception e) {
             log.info("Unable to undeploy assembly", e);

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseSystemService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseSystemService.java?rev=427935&r1=427934&r2=427935&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseSystemService.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseSystemService.java
Wed Aug  2 02:10:28 2006
@@ -50,13 +50,14 @@
     public void init(JBIContainer container) throws JBIException {
         this.container = container;
         container.getManagementContext().registerSystemService(this, getServiceMBean());
+        super.init();
     }
 
     public void shutDown() throws JBIException {
         stop();
         super.shutDown();
         if (container != null && container.getManagementContext() != null) {
-            container.getManagementContext().unregisterMBean(this);
+            container.getManagementContext().unregisterSystemService(this);
         }
     }
 

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java?rev=427935&r1=427934&r2=427935&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/ManagementContext.java
Wed Aug  2 02:10:28 2006
@@ -208,7 +208,7 @@
     /**
      * Lookup a JBI Installable Component by its unique name.
      * 
-     * @param name - is the name of the BC or SE.
+     * @param componentName - is the name of the BC or SE.
      * @return the JMX object name of the component's LifeCycle MBean or null.
      */
     public ObjectName getComponentByName(String componentName) {
@@ -426,8 +426,7 @@
     
     /**
      * Create an ObjectName
-     * @param domain 
-     * 
+     * @param props
      * @return the ObjectName
      */
     public ObjectName createObjectName(Map props) {
@@ -562,6 +561,7 @@
      */
     public void registerSystemService(BaseSystemService service, Class interfaceType) throws
JBIException {
         try {
+
             String name = service.getName();
             if (systemServices.containsKey(name)) {
                 throw new JBIException("A system service for the name " + name + " is already
registered");
@@ -582,10 +582,28 @@
     }
 
     /**
+     * Unregister a System service
+     *
+     * @param service
+     * @throws JBIException
+     */
+    public void unregisterSystemService(BaseSystemService service) throws JBIException {
+        String name = service.getName();
+        if (!systemServices.containsKey(name)) {
+            throw new JBIException("A system service for the name " + name + " is not registered");
+        }
+        ObjectName objName = (ObjectName)systemServices.remove(name);
+        if (log.isDebugEnabled()) {
+            log.debug("Unregistering system service: " + objName);
+        }
+        unregisterMBean(objName);
+    }
+
+    /**
      * Unregister an MBean
      * 
      * @param name
-     * @throws JMException
+     * @throws JBIException
      */
     public void unregisterMBean(ObjectName name) throws JBIException {
         try{
@@ -601,7 +619,7 @@
      * Unregister an MBean
      * 
      * @param bean
-     * @throws JMException
+     * @throws JBIException
      */
     public void unregisterMBean(Object bean) throws JBIException {
         for (Iterator i = beanMap.entrySet().iterator();i.hasNext();) {
@@ -626,7 +644,7 @@
     	AttributeInfoHelper helper = new AttributeInfoHelper();
     	helper.addAttribute(getObjectToManage(), "bindingComponents", "Get list of all binding
components");
     	helper.addAttribute(getObjectToManage(), "engineComponents", "Get list of all engine
components");
-    helper.addAttribute(getObjectToManage(), "pojoComponents", "Get list of all pojo components");
+        helper.addAttribute(getObjectToManage(), "pojoComponents", "Get list of all pojo
components");
     	helper.addAttribute(getObjectToManage(), "systemInfo", "Return current version");
     	helper.addAttribute(getObjectToManage(), "systemServices", "Get list of system services");
     	return AttributeInfoHelper.join(super.getAttributeInfos(), helper.getAttributeInfos());



Mime
View raw message