diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules')
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); } } |