diff options
author | slewis | 2016-03-09 00:23:14 +0000 |
---|---|---|
committer | slewis | 2016-03-09 00:23:14 +0000 |
commit | 0244ad4f88f0a262da69c93745b98e4418e330db (patch) | |
tree | c57e6d732de088c266a97f45e9ea95f5e8bbb48a | |
parent | d0ee492ff46385df075d8f2e32709fba9f4233b6 (diff) | |
download | org.eclipse.ecf-0244ad4f88f0a262da69c93745b98e4418e330db.tar.gz org.eclipse.ecf-0244ad4f88f0a262da69c93745b98e4418e330db.tar.xz org.eclipse.ecf-0244ad4f88f0a262da69c93745b98e4418e330db.zip |
Improved fix for bugR-Release_HEAD-sdk_feature-247_247
https://bugs.eclipse.org/bugs/show_bug.cgi?id=489177
Change-Id: I0000000000000000000000000000000000000000
2 files changed, 22 insertions, 25 deletions
diff --git a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java index f7861d151..7b442db09 100644 --- a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java +++ b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java @@ -57,6 +57,9 @@ public class Activator implements BundleActivator { public static final String PLUGIN_ID = "org.eclipse.ecf.osgi.services.remoteserviceadmin"; //$NON-NLS-1$ + private static final String RSA_PROXY_PREFIX = "ECF RSA PROXY for ED="; //$NON-NLS-1$ + private static final String RSA_PROXY_BUNDLE_SYMBOLIC_ID = "org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy"; //$NON-NLS-1$ + private static BundleContext context; private static Activator instance; @@ -87,8 +90,6 @@ public class Activator implements BundleActivator { private Object saxParserFactoryTrackerLock = new Object(); private ServiceTracker saxParserFactoryTracker; - private static final String RSA_PROXY_BUNDLE_SYMBOLIC_ID = "org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy"; //$NON-NLS-1$ - private BundleContext proxyServiceFactoryBundleContext; private Collection<ExportRegistration> exportedRegistrations; @@ -178,8 +179,6 @@ public class Activator implements BundleActivator { return (proxyBundle != null)?proxyBundle.getBundleContext():proxyServiceFactoryBundleContext; } - private static final String RSA_PROXY_PREFIX = "ECF RSA PROXY for "; //$NON-NLS-1$ - static Bundle findExistingProxyBundle(String bundleSymbolicName) { BundleContext bc = getContext(); if (bc != null) diff --git a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java index 37cf353ef..2b6d0d789 100644 --- a/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java +++ b/osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java @@ -43,9 +43,9 @@ import org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.Activator; import org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.DebugOptions; import org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.LogUtility; import org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.PropertiesUtil; -import org.eclipse.ecf.remoteservice.IRSAConsumerContainerAdapter; import org.eclipse.ecf.remoteservice.IExtendedRemoteServiceRegistration; import org.eclipse.ecf.remoteservice.IOSGiRemoteServiceContainerAdapter; +import org.eclipse.ecf.remoteservice.IRSAConsumerContainerAdapter; import org.eclipse.ecf.remoteservice.IRemoteService; import org.eclipse.ecf.remoteservice.IRemoteServiceContainer; import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter; @@ -929,11 +929,10 @@ public class RemoteServiceAdmin implements class ImportEndpoint { - private ID importContainerID; + private IRemoteServiceContainer rsContainer; private IRemoteService rs; - private IRemoteServiceContainerAdapter rsContainerAdapter; - private EndpointDescription endpointDescription; private IRemoteServiceListener rsListener; + private EndpointDescription endpointDescription; private IRemoteServiceReference rsReference; private ServiceRegistration proxyRegistration; private Set<ImportRegistration> activeImportRegistrations = new HashSet<ImportRegistration>(); @@ -945,25 +944,22 @@ public class RemoteServiceAdmin implements return buf.toString(); } - ImportEndpoint(ID importContainerID, IRemoteServiceContainerAdapter rsContainerAdapter, + ImportEndpoint(IRemoteServiceContainer rsContainer, IRemoteServiceReference rsReference, IRemoteService rs, - IRemoteServiceListener rsListener, ServiceRegistration proxyRegistration, EndpointDescription endpointDescription) { - this.importContainerID = importContainerID; - this.rsContainerAdapter = rsContainerAdapter; - this.endpointDescription = endpointDescription; + this.rsContainer = rsContainer; this.rsReference = rsReference; + this.endpointDescription = endpointDescription; this.rs = rs; - this.rsListener = rsListener; this.proxyRegistration = proxyRegistration; + this.rsListener = new RemoteServiceListener(); // Add the remoteservice listener to the container adapter, so that // the rsListener notified asynchronously if our underlying remote - // service - // reference is unregistered locally due to disconnect or remote + // service reference is unregistered locally due to disconnect or remote // ejection - this.rsContainerAdapter.addRemoteServiceListener(this.rsListener); + this.rsContainer.getContainerAdapter().addRemoteServiceListener(this.rsListener); } synchronized EndpointDescription getEndpointDescription() { @@ -988,24 +984,28 @@ public class RemoteServiceAdmin implements .remove(importRegistration); if (removed && activeImportRegistrations.size() == 0) { if (proxyRegistration != null) { - proxyRegistration.unregister(); + try { + proxyRegistration.unregister(); + } catch (Throwable t) { + // do nothing + } proxyRegistration = null; } + IRemoteServiceContainerAdapter rsContainerAdapter = rsContainer.getContainerAdapter(); if (rsContainerAdapter != null) { if (rsReference != null) { rsContainerAdapter.ungetRemoteService(rsReference); rsReference = null; } - // remove remote service listener if (rsListener != null) { rsContainerAdapter .removeRemoteServiceListener(rsListener); rsListener = null; } - rs = null; - rsContainerAdapter = null; } + rs = null; endpointDescription = null; + rsContainer = null; } return removed; } @@ -1030,7 +1030,7 @@ public class RemoteServiceAdmin implements EndpointDescription updatedEndpoint = (endpoint instanceof EndpointDescription) ? ((EndpointDescription) endpoint) : new EndpointDescription(endpoint.getProperties()); // Create new proxy properties from updatedEndpoint and rsReference and rs - Map newProxyProperties = createProxyProperties(importContainerID, updatedEndpoint, + Map newProxyProperties = createProxyProperties(rsContainer.getContainer().getID(), updatedEndpoint, rsReference, rs); // set the endpoint description with the proxy properties updatedEndpoint.setPropertiesOverrides(newProxyProperties); @@ -1855,9 +1855,7 @@ public class RemoteServiceAdmin implements } }); - return new ImportEndpoint(rsContainerID, containerAdapter, selectedRsReference, rs, - new RemoteServiceListener(), proxyRegistration, - endpointDescription); + return new ImportEndpoint(rsContainer, selectedRsReference, rs, proxyRegistration, endpointDescription); } private BundleContext getProxyServiceFactoryContext( |