You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/10/11 11:53:35 UTC

camel git commit: Replace the inefficient Double constructor with static Double.valueOf() method.

Repository: camel
Updated Branches:
  refs/heads/master fdb0d18a6 -> 25a33a330


Replace the inefficient Double constructor with static Double.valueOf() method.

Using new Double(double) is guaranteed to always result in a new object whereas Double.valueOf(double) allows caching of values to be done by the compiler, class library, or JVM.
Using of cached values avoids object allocation and the code will be faster.
http://findbugs.sourceforge.net/bugDescriptions.html#DM_FP_NUMBER_CTOR


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/25a33a33
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/25a33a33
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/25a33a33

Branch: refs/heads/master
Commit: 25a33a330ca62c884ecdc8e376b6605434fd7ae6
Parents: fdb0d18
Author: Kui LIU <br...@gmail.com>
Authored: Wed Oct 11 10:44:43 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Oct 11 13:53:02 2017 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/25a33a33/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
index ed2e53b..bbc3d60 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
@@ -160,7 +160,7 @@ public class SqsConsumer extends ScheduledBatchPollingConsumer {
             if (this.scheduledExecutor != null && visibilityTimeout != null && (visibilityTimeout.intValue() / 2) > 0) {
                 int delay = visibilityTimeout.intValue() / 2;
                 int period = visibilityTimeout.intValue();
-                int repeatSeconds = new Double(visibilityTimeout.doubleValue() * 1.5).intValue();
+                int repeatSeconds = Double.valueOf(visibilityTimeout.doubleValue() * 1.5).intValue();
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Scheduled TimeoutExtender task to start after {} delay, and run with {}/{} period/repeat (seconds), to extend exchangeId: {}",
                             new Object[]{delay, period, repeatSeconds, exchange.getExchangeId()});