diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-06 13:18:15 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-06 13:18:15 +0000 |
commit | 069744ba06cca232eee0f0784f1721816d343343 (patch) | |
tree | 494fc5d8307ea74a45ebd84f4803413482a5ff1c /sca-java-2.x/trunk/modules/core | |
parent | 6fcdf3c9397dfc414831f8a31b991252d54818ee (diff) |
TUSCANY-3867 - Catch exceptions thrown from constructors and in @Init to allow the processing to complete tidily. You can then check the monitor to see if something went wrong and shut down cleanly.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1132625 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core')
2 files changed, 33 insertions, 16 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 362849f28b..367c082839 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 @@ -524,7 +524,11 @@ public class CompositeActivatorImpl implements CompositeActivator { // registered before any @EagerInit takes place public void start(CompositeContext compositeContext, ScopedRuntimeComponent scopedRuntimeComponent) { if (scopedRuntimeComponent.getScopeContainer() != null) { - scopedRuntimeComponent.getScopeContainer().start(); + try { + scopedRuntimeComponent.getScopeContainer().start(); + } catch (Throwable ex){ + Monitor.error(monitor, this, "core-messages", "StartException", ex); + } } } @@ -539,24 +543,32 @@ public class CompositeActivatorImpl implements CompositeActivator { for (PolicyProvider policyProvider : ep.getPolicyProviders()) { policyProvider.start(); if (providers != null) { - providers.add(policyProvider); + try { + providers.add(policyProvider); + } catch (Throwable ex){ + Monitor.error(monitor, this, "core-messages", "StartException", ex); + } } } final ServiceBindingProvider bindingProvider = ep.getBindingProvider(); if (bindingProvider != null) { - // bindingProvider.start(); - // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy. - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { - bindingProvider.start(); - if (providers != null) { - providers.add(bindingProvider); - } - return null; - } - }); - compositeContext.getEndpointRegistry().addEndpoint(ep); + try { + // bindingProvider.start(); + // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy. + AccessController.doPrivileged(new PrivilegedAction<Object>() { + public Object run() { + bindingProvider.start(); + if (providers != null) { + providers.add(bindingProvider); + } + return null; + } + }); + compositeContext.getEndpointRegistry().addEndpoint(ep); + } catch (Throwable ex){ + Monitor.error(monitor, this, "core-messages", "StartException", ex); + } } } @@ -611,7 +623,11 @@ public class CompositeActivatorImpl implements CompositeActivator { ((EndpointReferenceAsyncProvider)bindingProvider).supportsNativeAsync() && epr.isAsyncInvocation()){ // it's resolved so start it now - start(compositeContext, epr); + try { + start(compositeContext, epr); + } catch (Throwable ex){ + Monitor.error(monitor, this, "core-messages", "StartException", ex); + } } } } diff --git a/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties b/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties index 83eafc1278..f6346b885f 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties +++ b/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties @@ -17,4 +17,5 @@ # under the License. # # -StopException = Exception during stop processing
\ No newline at end of file +StopException = Exception during stop processing +StartException = Exception during start processing
\ No newline at end of file |