[jboss-cvs] JBossAS SVN: r97486 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Dec 6 07:30:28 EST 2009


Author: alesj
Date: 2009-12-06 07:30:28 -0500 (Sun, 06 Dec 2009)
New Revision: 97486

Modified:
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
Log:
Fix bundle stop + its services unregistry bug.

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-12-06 03:30:23 UTC (rev 97485)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-12-06 12:30:28 UTC (rev 97486)
@@ -1430,11 +1430,26 @@
    }
 
    /**
+    * Unregister contexts.
+    *
+    * @param bundleState the stopping bundle
+    */
+   void unregisterContexts(OSGiBundleState bundleState)
+   {
+      DeploymentUnit unit = bundleState.getDeploymentUnit();
+      Set<ControllerContext> contexts = registry.getContexts(unit);
+      for (ControllerContext context : contexts)
+      {
+         unregisterContext(context);
+      }
+   }
+
+   /**
     * Unregister context.
     *
     * @param context the context
     */
-   void unregisterContext(ControllerContext context)
+   private void unregisterContext(ControllerContext context)
    {
       if (context instanceof ServiceRegistration)
       {
@@ -1454,7 +1469,7 @@
    {
       ControllerContextHandle handle = (ControllerContextHandle)reference;
       ControllerContext context = handle.getContext();
-      if (isUnregistered(context))  // we're probably not installed anymore
+      if (isUnregistered(context)) // we're probably not installed anymore
          return null;
 
       return bundleState.addContextInUse(context);

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java	2009-12-06 03:30:23 UTC (rev 97485)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java	2009-12-06 12:30:28 UTC (rev 97486)
@@ -359,10 +359,11 @@
                }
                count--;
             }
-
-            getBundleManager().unregisterContext(context);
          }
 
+         // unregister bundle's contexts
+         getBundleManager().unregisterContexts(this);
+
          if (getState() != STOPPING)
             throw new BundleException("Bundle has been uninstalled: " + getCanonicalName());
       }




More information about the jboss-cvs-commits mailing list