[jboss-osgi-commits] JBoss-OSGI SVN: r97484 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Sat Dec 5 16:10:56 EST 2009
Author: alesj
Date: 2009-12-05 16:10:55 -0500 (Sat, 05 Dec 2009)
New Revision: 97484
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
Log:
Proper service unget. TODO more tests.
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2009-12-05 20:03:56 UTC (rev 97483)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2009-12-05 21:10:55 UTC (rev 97484)
@@ -431,7 +431,7 @@
ContextTracker ct = getContextTracker();
int count = ct.getUsedByCount(this, bundleState);
- if (count == 1 || (count == 2 && ct == bundleState)) // remove & unget, double count if tracker == bundle
+ if (count == 0) // remove & unget
{
serviceCache.remove(bundleState);
ServiceFactory serviceFactory = (ServiceFactory)serviceOrFactory;
@@ -674,11 +674,20 @@
Set<Object> users = ct.getUsers(this);
if (users.isEmpty() == false)
{
+ Set<AbstractBundleState> used = new HashSet<AbstractBundleState>();
OSGiBundleManager manager = bundleState.getBundleManager();
for (Object user : users)
{
AbstractBundleState using = manager.getBundleForUser(user);
- using.ungetContex(this); // ungetService will cleanup service cache
+ if (used.add(using)) // add so we don't do duplicate work
+ {
+ int count = ct.getUsedByCount(this, using);
+ while(count > 0)
+ {
+ using.ungetContex(this); // ungetService will cleanup service cache
+ count--;
+ }
+ }
}
}
}
More information about the jboss-osgi-commits
mailing list