brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [2/3] git commit: clearer comment
Date Wed, 11 Jun 2014 22:35:13 GMT
clearer comment


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/eb175501
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/eb175501
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/eb175501

Branch: refs/heads/master
Commit: eb175501bba678db84117fca94817b4e5aab7145
Parents: 4b3d1e2
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Jun 11 15:26:05 2014 -0700
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed Jun 11 15:26:05 2014 -0700

----------------------------------------------------------------------
 utils/common/src/main/java/brooklyn/util/repeat/Repeater.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/eb175501/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java b/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java
index eb57887..bfbe1f9 100644
--- a/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java
+++ b/utils/common/src/main/java/brooklyn/util/repeat/Repeater.java
@@ -170,6 +170,9 @@ public class Repeater {
         return delayOnIteration(new Function<Integer, Duration>() {
             @Override
             public Duration apply(Integer iteration) {
+                /* we iterate because otherwise we risk overflow errors by using multiplier^iteration;

+                 * e.g. with:
+                 * return Duration.min(initialDelay.multiply(Math.pow(multiplier, iteration)),
finalDelay); */
                 Duration result = initialDelay;
                 for (int i=0; i<iteration; i++) {
                     result = result.multiply(multiplier);
@@ -177,8 +180,6 @@ public class Repeater {
                         return finalDelay;
                 }
                 return result;
-                // prefer the above to the below because the below can overflow in loops
get large
-//                return Duration.min(initialDelay.multiply(Math.pow(multiplier, iteration)),
finalDelay);
             }
         });
     }


Mime
View raw message