Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EDF9F200C91 for ; Sat, 27 May 2017 09:29:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id ECD17160BD7; Sat, 27 May 2017 07:29:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EC585160BE1 for ; Sat, 27 May 2017 09:29:05 +0200 (CEST) Received: (qmail 24974 invoked by uid 500); 27 May 2017 07:29:05 -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 24341 invoked by uid 99); 27 May 2017 07:29:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 May 2017 07:29:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5CDFCE9638; Sat, 27 May 2017 07:29:04 +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: Sat, 27 May 2017 07:29:11 -0000 Message-Id: In-Reply-To: <3e0607a7440f419689cc0fb55db97775@git.apache.org> References: <3e0607a7440f419689cc0fb55db97775@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [8/9] camel git commit: Small optimization on exchange to avoid looking up unnessasary type conversion and setting a null value on the property archived-at: Sat, 27 May 2017 07:29:07 -0000 Small optimization on exchange to avoid looking up unnessasary type conversion and setting a null value on the property Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b16a262a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b16a262a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b16a262a Branch: refs/heads/master Commit: b16a262a92dfbcab8a3b346fb93be1791b3665bc Parents: 88ca1fb Author: Claus Ibsen Authored: Fri May 26 18:05:18 2017 +0200 Committer: Claus Ibsen Committed: Sat May 27 09:03:47 2017 +0200 ---------------------------------------------------------------------- .../java/org/apache/camel/impl/DefaultExchange.java | 12 +++++++----- .../java/org/apache/camel/impl/DefaultUnitOfWork.java | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/b16a262a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java index 97b10a2..f43396a 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java @@ -426,11 +426,13 @@ public final class DefaultExchange implements Exchange { // lets avoid adding methods to the Message API, so we use the // DefaultMessage to allow component specific messages to extend // and implement the isExternalRedelivered method. - DefaultMessage msg = getIn(DefaultMessage.class); - if (msg != null) { - answer = msg.isTransactedRedelivered(); - // store as property to keep around - setProperty(Exchange.EXTERNAL_REDELIVERED, answer); + Message msg = getIn(); + if (msg instanceof DefaultMessage) { + answer = ((DefaultMessage) msg).isTransactedRedelivered(); + if (answer != null) { + // store as property to keep around + setProperty(Exchange.EXTERNAL_REDELIVERED, answer); + } } } http://git-wip-us.apache.org/repos/asf/camel/blob/b16a262a/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java index 607afff..cb7e2a8 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java @@ -115,7 +115,10 @@ public class DefaultUnitOfWork implements UnitOfWork, Service { // setup whether the exchange is externally redelivered or not (if not initialized before) // store as property so we know that the origin exchange was redelivered if (exchange.getProperty(Exchange.EXTERNAL_REDELIVERED) == null) { - exchange.setProperty(Exchange.EXTERNAL_REDELIVERED, exchange.isExternalRedelivered()); + Boolean redelivered = exchange.isExternalRedelivered(); + if (redelivered != null) { + exchange.setProperty(Exchange.EXTERNAL_REDELIVERED, redelivered); + } } // fire event