diff options
Diffstat (limited to '')
7 files changed, 36 insertions, 9 deletions
diff --git a/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java b/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java index bd92312235..4b5fffff01 100644 --- a/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java +++ b/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java @@ -78,7 +78,11 @@ public class OSGiExtensionPointRegistry extends DefaultExtensionPointRegistry { protected void unregisterExtensionPoint(Class<?> i) { ServiceRegistration registration = registrations.remove(i); if (registration != null) { - registration.unregister(); + try { + registration.unregister(); + } catch (IllegalStateException e) { + // The service has been unregistered, ignore it + } } super.unregisterExtensionPoint(i); } diff --git a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java index 5c13b3d04e..7b5b5f2ea1 100644 --- a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java +++ b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java @@ -130,8 +130,7 @@ public class OSGiImplementationProvider implements ImplementationProvider { try { registration.unregister(); } catch (IllegalStateException e) { - // The service has been unregistered - // Ignore + // The service has been unregistered, ignore it } } registrations.clear(); diff --git a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java index 8bbfc19323..a1de00d240 100644 --- a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java +++ b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java @@ -39,7 +39,11 @@ public class OSGiImplementationRuntimeActivator implements BundleActivator { public void stop(BundleContext context) throws Exception { if (distributionProvider != null) { - distributionProvider.unregister(); + try { + distributionProvider.unregister(); + } catch (IllegalStateException e) { + // The service has been unregistered, ignore it + } } bundleContext = null; } diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiNodeFactoryImpl.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiNodeFactoryImpl.java index 1181f49300..09e32ccc56 100644 --- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiNodeFactoryImpl.java +++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiNodeFactoryImpl.java @@ -111,7 +111,11 @@ public class OSGiNodeFactoryImpl extends NodeFactoryImpl { public synchronized void destroy() { if (inited) { if (registration != null) { - registration.unregister(); + try { + registration.unregister(); + } catch (IllegalStateException e) { + // The service has been unregistered, ignore it + } registration = null; } super.destroy(); diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java index 83fd31512b..bc2e3ce012 100644 --- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java +++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java @@ -78,11 +78,19 @@ public class RemoteServiceAdminImpl implements RemoteServiceAdmin, ManagedServic public void stop() { if (registration != null) { - registration.unregister(); + try { + registration.unregister(); + } catch (IllegalStateException e) { + // The service has been unregistered, ignore it + } registration = null; } if (managedService != null) { - managedService.unregister(); + try { + managedService.unregister(); + } catch (IllegalStateException e) { + // The service has been unregistered, ignore it + } managedService = null; } if (listeners != null) { diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java index 7c7a873d82..75c6dd412d 100644 --- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java +++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java @@ -374,7 +374,11 @@ public class TopologyManagerImpl implements ListenerHook, RemoteServiceAdminList remotableServices.close(); if (registration != null) { - registration.unregister(); + try { + registration.unregister(); + } catch (IllegalStateException e) { + // The service has been unregistered, ignore it + } registration = null; } if (remoteAdmins != null) { diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DiscoveryActivator.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DiscoveryActivator.java index 9a48dd25f7..32bd10b77b 100644 --- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DiscoveryActivator.java +++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DiscoveryActivator.java @@ -44,7 +44,11 @@ public class DiscoveryActivator implements BundleActivator { public void stop(BundleContext context) { for (ServiceRegistration registration : discoveryServiceRegistrations) { - registration.unregister(); + try { + registration.unregister(); + } catch (IllegalStateException e) { + // The service has been unregistered, ignore it + } } for (AbstractDiscoveryService service : discoveryServices) { service.stop(); |