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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 28 15:26:21 EST 2009


Author: alesj
Date: 2009-11-28 15:26:20 -0500 (Sat, 28 Nov 2009)
New Revision: 97130

Modified:
   projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
   projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
Log:
Remove custom service unregistration.

Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-11-28 16:55:14 UTC (rev 97129)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-11-28 20:26:20 UTC (rev 97130)
@@ -1364,6 +1364,20 @@
    }
 
    /**
+    * Unregister context.
+    *
+    * @param context the context
+    */
+   void unregisterContext(ControllerContext context)
+   {
+      if (context instanceof OSGiServiceState)
+      {
+         OSGiServiceState service = (OSGiServiceState)context;
+         service.unregister();
+      }
+   }
+
+   /**
     * Get a service
     * 
     * @param bundleState the bundle that requests the service
@@ -1439,7 +1453,7 @@
     * @param context the context
     * @return true when the context is still in use by the bundle
     */
-   boolean ungetContext(AbstractBundleState bundleState, org.jboss.dependency.spi.ControllerContext context)
+   boolean ungetContext(AbstractBundleState bundleState, ControllerContext context)
    {
       return bundleState.removeContextInUse(context);
    }

Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java	2009-11-28 16:55:14 UTC (rev 97129)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java	2009-11-28 20:26:20 UTC (rev 97130)
@@ -27,6 +27,7 @@
 import java.util.Enumeration;
 import java.util.concurrent.atomic.AtomicLong;
 
+import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.osgi.framework.metadata.OSGiMetaData;
@@ -343,24 +344,23 @@
             }
          }
 
-         // TODO - I guess we need to unget them all, but only OSGi will have a real "unget" notion
-         for (OSGiServiceState service : getUsedContexts(OSGiServiceState.class))
+         for (ControllerContext context : getUsedContexts(null))
          {
-            int count = getUsedByCount(service, this);
+            int count = getUsedByCount(context, this);
             while (count > 0)
             {
                try
                {
-                  getBundleManager().ungetService(this, service);
+                  getBundleManager().ungetContext(this, context);
                }
                catch (Throwable t)
                {
-                  log.debug("Error ungetting service: " + service, t);
+                  log.debug("Error ungetting service: " + context, t);
                }
                count--;
             }
 
-            service.unregister();
+            getBundleManager().unregisterContext(context);
          }
 
          if (getState() != STOPPING)




More information about the jboss-cvs-commits mailing list