From db627bc1b830b456032abc2aa5bbd39106dfa0c7 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 21 Feb 2011 14:15:59 +0000 Subject: TUSCANY-3834: Update to use the Monitor when logging the stop exception git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1072974 13f79535-47bb-0310-9956-ffa450edef68 --- .../core/assembly/impl/CompositeActivatorImpl.java | 22 +++++++++++++--------- .../src/main/resources/core-messages.properties | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties (limited to 'sca-java-2.x/trunk/modules/core/src') 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 3604f81ec4..15aab449d4 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 @@ -41,6 +41,8 @@ import org.apache.tuscany.sca.core.scope.ScopeContainer; import org.apache.tuscany.sca.core.scope.ScopeRegistry; import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent; import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.provider.EndpointReferenceAsyncProvider; import org.apache.tuscany.sca.provider.ImplementationProvider; import org.apache.tuscany.sca.provider.ImplementationProviderFactory; @@ -66,11 +68,13 @@ public class CompositeActivatorImpl implements CompositeActivator { private final ScopeRegistry scopeRegistry; private final ProviderFactoryExtensionPoint providerFactories; + private Monitor monitor; public CompositeActivatorImpl(ExtensionPointRegistry extensionPoints) { UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); this.scopeRegistry = utilities.getUtility(ScopeRegistry.class); this.providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class); + this.monitor = utilities.getUtility(MonitorFactory.class).createMonitor(); } //========================================================================= @@ -393,7 +397,7 @@ public class CompositeActivatorImpl implements CompositeActivator { try { stop(compositeContext, (Composite) implementation); } catch (Throwable e1) { - logger.log(Level.SEVERE, e1.getMessage(), e1); + Monitor.error(monitor, this, "core-messages", "StopException", e1); } rethrow(e); } @@ -427,7 +431,7 @@ public class CompositeActivatorImpl implements CompositeActivator { try { providers.get(i).stop(); } catch (Throwable e1) { - logger.log(Level.SEVERE, e1.getMessage(), e1); + Monitor.error(monitor, this, "core-messages", "StopException", e1); } } rethrow(e); @@ -488,14 +492,14 @@ public class CompositeActivatorImpl implements CompositeActivator { } }); } catch (Throwable ex){ - logger.log(Level.SEVERE, ex.getMessage(), ex); + Monitor.error(monitor, this, "core-messages", "StopException", ex); } } for (PolicyProvider policyProvider : ((RuntimeComponent)component).getPolicyProviders()) { try { policyProvider.stop(); } catch (Throwable ex){ - logger.log(Level.SEVERE, ex.getMessage(), ex); + Monitor.error(monitor, this, "core-messages", "StopException", ex); } } } @@ -507,7 +511,7 @@ public class CompositeActivatorImpl implements CompositeActivator { try { runtimeComponent.getScopeContainer().stop(); } catch (Throwable ex){ - logger.log(Level.SEVERE, ex.getMessage(), ex); + Monitor.error(monitor, this, "core-messages", "StopException", ex); } } } @@ -570,14 +574,14 @@ public class CompositeActivatorImpl implements CompositeActivator { } }); } catch (Throwable ex){ - logger.log(Level.SEVERE, ex.getMessage(), ex); + Monitor.error(monitor, this, "core-messages", "StopException", ex); } } for (PolicyProvider policyProvider : ep.getPolicyProviders()) { try { policyProvider.stop(); } catch (Throwable ex){ - logger.log(Level.SEVERE, ex.getMessage(), ex); + Monitor.error(monitor, this, "core-messages", "StopException", ex); } } } @@ -645,14 +649,14 @@ public class CompositeActivatorImpl implements CompositeActivator { try { bindingProvider.stop(); } catch (Throwable ex){ - logger.log(Level.SEVERE, ex.getMessage(), ex); + Monitor.error(monitor, this, "core-messages", "StopException", ex); } } for (PolicyProvider policyProvider : epr.getPolicyProviders()) { try { policyProvider.stop(); } catch (Throwable ex){ - logger.log(Level.SEVERE, ex.getMessage(), ex); + Monitor.error(monitor, this, "core-messages", "StopException", 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 new file mode 100644 index 0000000000..83eafc1278 --- /dev/null +++ b/sca-java-2.x/trunk/modules/core/src/main/resources/core-messages.properties @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +StopException = Exception during stop processing \ No newline at end of file -- cgit v1.2.3