You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ri...@apache.org on 2014/06/12 00:35:13 UTC

[2/3] git commit: clearer comment

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 <al...@cloudsoftcorp.com>
Authored: Wed Jun 11 15:26:05 2014 -0700
Committer: Alex Heneveld <al...@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);
             }
         });
     }