diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-09 18:25:21 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-09 18:25:21 +0000 |
commit | 6f8dabf80393ef4d717f322a136300cb092226ed (patch) | |
tree | 1b0f902b2770ac17737c3ea2e197e20bf80f2f20 /sca-java-2.x/trunk/modules/core | |
parent | 223d65e9e67a6bf9363f901f2fb261ceace26c2c (diff) |
TUSCANY-3834 - ensure that exceptions in @Destroy operations are handled and allow the top process to continue for other components
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1069015 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core')
2 files changed, 49 insertions, 19 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java index 6ec740ae20..3604f81ec4 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java @@ -479,16 +479,24 @@ 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); + } } for (PolicyProvider policyProvider : ((RuntimeComponent)component).getPolicyProviders()) { - policyProvider.stop(); + try { + policyProvider.stop(); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } @@ -496,7 +504,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); + } } } @@ -549,16 +561,24 @@ public class CompositeActivatorImpl implements CompositeActivator { ep.getCompositeContext().getEndpointRegistry().removeEndpoint(ep); final ServiceBindingProvider bindingProvider = ep.getBindingProvider(); 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 (PolicyProvider policyProvider : ep.getPolicyProviders()) { - policyProvider.stop(); + try { + policyProvider.stop(); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } @@ -622,10 +642,18 @@ public class CompositeActivatorImpl implements CompositeActivator { compositeContext.getEndpointRegistry().removeEndpointReference(epr); ReferenceBindingProvider bindingProvider = epr.getBindingProvider(); if (bindingProvider != null) { - bindingProvider.stop(); + try { + bindingProvider.stop(); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } for (PolicyProvider policyProvider : epr.getPolicyProviders()) { - policyProvider.stop(); + try { + policyProvider.stop(); + } catch (Throwable ex){ + logger.log(Level.SEVERE, ex.getMessage(), ex); + } } } } diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java index 730f92e0f9..efe7c94b54 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java @@ -46,6 +46,7 @@ public class CompositeScopeContainer<KEY> extends AbstractScopeContainer<KEY> { try { wrapper.stop(); } catch (TargetDestructionException e) { + wrapper = null; throw new IllegalStateException(e); } } @@ -59,6 +60,7 @@ public class CompositeScopeContainer<KEY> extends AbstractScopeContainer<KEY> { wrapper = createInstanceWrapper(); wrapper.start(); } catch (Exception e) { + wrapper = null; throw new ServiceUnavailableException(e); } } |