Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 29E491098C for ; Fri, 8 Nov 2013 14:18:19 +0000 (UTC) Received: (qmail 43300 invoked by uid 500); 8 Nov 2013 14:18:15 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 42998 invoked by uid 500); 8 Nov 2013 14:18:13 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 42865 invoked by uid 99); 8 Nov 2013 14:18:08 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Nov 2013 14:18:08 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4BC3A8159EF; Fri, 8 Nov 2013 14:18:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Fri, 08 Nov 2013 14:18:13 -0000 Message-Id: <0acaf11cf3774d5aa19e9d4ec92bf06d@git.apache.org> In-Reply-To: <322643907a63494c94819733150db42b@git.apache.org> References: <322643907a63494c94819733150db42b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [6/8] git commit: beforeStop on Main should do internal stop logic in independet method, as end users most likely wont call super when they override the method to do their custom logic. beforeStop on Main should do internal stop logic in independet method, as end users most likely wont call super when they override the method to do their custom logic. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e771d52c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e771d52c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e771d52c Branch: refs/heads/camel-2.12.x Commit: e771d52c51a8cf0ebd8226c0251fccddf58d6e6f Parents: 0717340 Author: Claus Ibsen Authored: Fri Nov 8 15:18:11 2013 +0100 Committer: Claus Ibsen Committed: Fri Nov 8 15:18:50 2013 +0100 ---------------------------------------------------------------------- .../main/java/org/apache/camel/main/MainSupport.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/e771d52c/camel-core/src/main/java/org/apache/camel/main/MainSupport.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/main/MainSupport.java b/camel-core/src/main/java/org/apache/camel/main/MainSupport.java index e040f9f..2a3498f 100644 --- a/camel-core/src/main/java/org/apache/camel/main/MainSupport.java +++ b/camel-core/src/main/java/org/apache/camel/main/MainSupport.java @@ -149,6 +149,7 @@ public abstract class MainSupport extends ServiceSupport { try { afterStart(); waitUntilCompleted(); + internalBeforeStop(); beforeStop(); stop(); } catch (Exception e) { @@ -178,9 +179,17 @@ public abstract class MainSupport extends ServiceSupport { * Callback to run custom logic before CamelContext is being stopped. */ protected void beforeStop() throws Exception { - if (camelTemplate != null) { - ServiceHelper.stopService(camelTemplate); - camelTemplate = null; + // noop + } + + private void internalBeforeStop() { + try { + if (camelTemplate != null) { + ServiceHelper.stopService(camelTemplate); + camelTemplate = null; + } + } catch (Exception e) { + LOG.debug("Error stopping camelTemplate due " + e.getMessage() + ". This exception is ignored.", e); } }