diff options
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); } } |