summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/node-impl-osgi/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-29 21:44:11 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-29 21:44:11 +0000
commit745a20f40b622b01bfab71ed29950ab568535cec (patch)
treed338a7533fe04929f27ce94bf82e7f696ae6ee12 /java/sca/modules/node-impl-osgi/src
parentecf04061e5efbb48144ef5bd37db42ab68e1d167 (diff)
Ignore IllegalStateException for service unregister()
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@831102 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/OSGiNodeFactoryImpl.java6
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java12
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java6
-rw-r--r--java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DiscoveryActivator.java6
4 files changed, 25 insertions, 5 deletions
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();