Author: slaws
Date: Mon Jun 6 13:18:15 2011
New Revision: 1132625
URL: http://svn.apache.org/viewvc?rev=1132625&view=rev
Log:
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.
Modified:
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
tuscany/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties
Modified:
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java?rev=1132625&r1=1132624&r2=1132625&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
Mon Jun 6 13:18:15 2011
@@ -524,7 +524,11 @@ public class CompositeActivatorImpl impl
// 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 impl
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 impl
((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);
+ }
}
}
}
Modified:
tuscany/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties?rev=1132625&r1=1132624&r2=1132625&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties
(original)
+++
tuscany/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties
Mon Jun 6 13:18:15 2011
@@ -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