diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-09 14:01:46 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-09 14:01:46 +0000 |
commit | 6daac2ac36b76c7c48b10846ce078c7b3b0cd6af (patch) | |
tree | b6b6a15363cc936d226106bf3acb2e53027a235b /sca-java-1.x/trunk/modules | |
parent | fad039bb8af6f2b1c9e1db927677e25318d06fc2 (diff) |
TUSCANY-3834 - continue stopping components in the case of exceptions thrown during a previous component stop.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1068894 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/modules')
2 files changed, 50 insertions, 29 deletions
diff --git a/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java b/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java index c5ffbc4a46..af3e6061a8 100644 --- a/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java +++ b/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java @@ -739,13 +739,17 @@ public class CompositeActivatorImpl implements CompositeActivator { for (Binding binding : service.getBindings()) { final ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service).getBindingProvider(binding); if (bindingProvider != null) { - // Allow bindings to read properties. Requires PropertyPermission read in security policy. - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { - bindingProvider.stop(); - return null; - } - }); + try { + // Allow bindings to read properties. Requires PropertyPermission read in security policy. + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + bindingProvider.stop(); + return null; + } + }); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } } @@ -758,26 +762,34 @@ public class CompositeActivatorImpl implements CompositeActivator { for (Binding binding : reference.getBindings()) { final ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding); if (bindingProvider != null) { - // Allow bindings to read properties. Requires PropertyPermission read in security policy. - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { - bindingProvider.stop(); - return null; - } - }); + try { + // Allow bindings to read properties. Requires PropertyPermission read in security policy. + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + bindingProvider.stop(); + return null; + } + }); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } for (Endpoint endpoint : reference.getEndpoints()) { final EndpointResolver endpointResolver = runtimeRef.getEndpointResolver(endpoint); if (endpointResolver != null) { - // Allow endpoint resolvers to do any shutdown reference manipulation - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { - endpointResolver.stop(); - return null; - } - }); + try { + // Allow endpoint resolvers to do any shutdown reference manipulation + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + endpointResolver.stop(); + return null; + } + }); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } } @@ -787,13 +799,17 @@ public class CompositeActivatorImpl implements CompositeActivator { } else { final ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider(); if (implementationProvider != null) { - // Allow bindings to read properties. Requires PropertyPermission read in security policy. - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { - implementationProvider.stop(); - return null; - } - }); + try { + // Allow bindings to read properties. Requires PropertyPermission read in security policy. + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + implementationProvider.stop(); + return null; + } + }); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } @@ -801,7 +817,11 @@ public class CompositeActivatorImpl implements CompositeActivator { ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component; if (runtimeComponent.getScopeContainer() != null && runtimeComponent.getScopeContainer().getLifecycleState() != ScopeContainer.STOPPED) { - runtimeComponent.getScopeContainer().stop(); + try { + runtimeComponent.getScopeContainer().stop(); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } diff --git a/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java b/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java index 7a1965198a..8c727ec76e 100644 --- a/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java +++ b/sca-java-1.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java @@ -40,6 +40,7 @@ public class CompositeScopeContainer<KEY> extends AbstractScopeContainer<KEY> { try { wrapper.stop(); } catch (TargetDestructionException e) { + wrapper = null; throw new IllegalStateException(e); } } |