You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2006/07/11 18:01:43 UTC
svn commit: r420907 -
/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
Author: rickhall
Date: Tue Jul 11 09:01:43 2006
New Revision: 420907
URL: http://svn.apache.org/viewvc?rev=420907&view=rev
Log:
Modified service unregistration to forcibly unget the service object
from all clients if they did not do so themselves in response to the
unregistering event.
Modified:
incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java?rev=420907&r1=420906&r2=420907&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java Tue Jul 11 09:01:43 2006
@@ -72,13 +72,27 @@
public void unregisterService(Bundle bundle, ServiceRegistration reg)
{
+ // First remove the registered service.
synchronized (this)
{
ServiceRegistration[] regs = (ServiceRegistration[]) m_serviceRegsMap.get(bundle);
m_serviceRegsMap.put(bundle, removeServiceRegistration(regs, reg));
}
+ // Fire the service event which gives all client bundles the
+ // opportunity to unget their service object.
fireServiceChanged(new ServiceEvent(ServiceEvent.UNREGISTERING, reg.getReference()));
+
+ // Now forcibly unget the service object for all stubborn clients.
+ synchronized (this)
+ {
+ Bundle[] clients = getUsingBundles(reg.getReference());
+ for (int i = 0; (clients != null) && (i < clients.length); i++)
+ {
+ while (ungetService(clients[i], reg.getReference()))
+ ; // Keep removing until it is no longer possible
+ }
+ }
}
/**