Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/osgi
diff options
context:
space:
mode:
authorMarkus Alexander Kuppe2014-01-21 17:23:48 +0000
committerMarkus Alexander Kuppe2014-01-21 17:31:45 +0000
commit4686f64589b126b6eba1fab9e03931216e11535c (patch)
treec161a904410be3823f144aaee88e8bf69d771489 /osgi
parent1cc6d5ee527154557a70fd5c918c113e34db3495 (diff)
downloadorg.eclipse.ecf-4686f64589b126b6eba1fab9e03931216e11535c.tar.gz
org.eclipse.ecf-4686f64589b126b6eba1fab9e03931216e11535c.tar.xz
org.eclipse.ecf-4686f64589b126b6eba1fab9e03931216e11535c.zip
Bug 425761: BasicTopologyManagerImpl does not notify EndpointListeners
https://bugs.eclipse.org/bugs/show_bug.cgi?id=425761 - Remove cache in BTMI \o/ - Handle concurrency in AbstractTopologyManager Change-Id: Id5331ab49fbd0f4e274717aad3bc213fad18f851
Diffstat (limited to 'osgi')
-rw-r--r--osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java62
1 files changed, 34 insertions, 28 deletions
diff --git a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java
index c4e06e121..936c0c01a 100644
--- a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java
+++ b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractTopologyManager.java
@@ -143,29 +143,33 @@ public abstract class AbstractTopologyManager {
*/
protected void advertiseEndpointDescription(
org.osgi.service.remoteserviceadmin.EndpointDescription endpointDescription) {
- final IServiceInfoFactory service = serviceInfoFactoryTracker
- .getService();
- if (service != null) {
- final IServiceInfo serviceInfo = service.createServiceInfo(null,
- endpointDescription);
- if (serviceInfo != null) {
- trace("advertiseEndpointDescription", //$NON-NLS-1$
- "advertising endpointDescription=" + endpointDescription + //$NON-NLS-1$
- " and IServiceInfo " + serviceInfo); //$NON-NLS-1$
-
- final ServiceRegistration<IServiceInfo> registerService = this.context
- .registerService(IServiceInfo.class, serviceInfo, null);
- this.registrations.put(endpointDescription, registerService);
-
+ synchronized (this.registrations) {
+ if (this.registrations.containsKey(endpointDescription)) {
+ return;
+ }
+ final IServiceInfoFactory service = serviceInfoFactoryTracker
+ .getService();
+ if (service != null) {
+ final IServiceInfo serviceInfo = service.createServiceInfo(null,
+ endpointDescription);
+ if (serviceInfo != null) {
+ trace("advertiseEndpointDescription", //$NON-NLS-1$
+ "advertising endpointDescription=" + endpointDescription + //$NON-NLS-1$
+ " and IServiceInfo " + serviceInfo); //$NON-NLS-1$
+
+ final ServiceRegistration<IServiceInfo> registerService = this.context
+ .registerService(IServiceInfo.class, serviceInfo, null);
+ this.registrations.put(endpointDescription, registerService);
+ } else {
+ logError(
+ "advertiseEndpointDescription", //$NON-NLS-1$
+ "IServiceInfoFactory failed to convert EndpointDescription " + endpointDescription); //$NON-NLS-1$1
+ }
} else {
logError(
"advertiseEndpointDescription", //$NON-NLS-1$
- "IServiceInfoFactory failed to convert EndpointDescription " + endpointDescription); //$NON-NLS-1$1
+ "no IServiceInfoFactory service found"); //$NON-NLS-1$
}
- } else {
- logError(
- "advertiseEndpointDescription", //$NON-NLS-1$
- "no IServiceInfoFactory service found"); //$NON-NLS-1$
}
}
@@ -174,16 +178,18 @@ public abstract class AbstractTopologyManager {
*/
protected void unadvertiseEndpointDescription(
org.osgi.service.remoteserviceadmin.EndpointDescription endpointDescription) {
- final ServiceRegistration<IServiceInfo> serviceRegistration = this.registrations
- .get(endpointDescription);
- if (serviceRegistration != null) {
- serviceRegistration.unregister();
- } else {
- logWarning("unadvertiseEndpointDescription", //$NON-NLS-1$
- "Failed to unadvertise endpointDescription: " //$NON-NLS-1$
- + endpointDescription
- + ". Seems it was never advertised."); //$NON-NLS-1$
+ synchronized (this.registrations) {
+ final ServiceRegistration<IServiceInfo> serviceRegistration = this.registrations
+ .remove(endpointDescription);
+ if (serviceRegistration != null) {
+ serviceRegistration.unregister();
+ return;
+ }
}
+ logWarning("unadvertiseEndpointDescription", //$NON-NLS-1$
+ "Failed to unadvertise endpointDescription: " //$NON-NLS-1$
+ + endpointDescription
+ + ". Seems it was never advertised."); //$NON-NLS-1$
}
protected void logError(String methodName, String message,

Back to the top