curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cammcken...@apache.org
Subject [1/2] curator git commit: CURATOR-262: Fixed integer overflow issue with sleepMs
Date Tue, 24 May 2016 22:32:53 GMT
Repository: curator
Updated Branches:
  refs/heads/master d63e06e84 -> 6ae3f8591


CURATOR-262: Fixed integer overflow issue with sleepMs


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/630c009a
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/630c009a
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/630c009a

Branch: refs/heads/master
Commit: 630c009a410eff13c4428704700d566abe417bda
Parents: 33c19d6
Author: Dimitar Dyankov <ddyankov@gmail.com>
Authored: Thu Feb 25 16:23:38 2016 -0800
Committer: Dimitar Dyankov <ddyankov@gmail.com>
Committed: Thu Feb 25 16:23:38 2016 -0800

----------------------------------------------------------------------
 .../org/apache/curator/retry/BoundedExponentialBackoffRetry.java | 2 +-
 .../java/org/apache/curator/retry/ExponentialBackoffRetry.java   | 4 ++--
 .../src/main/java/org/apache/curator/retry/RetryNTimes.java      | 2 +-
 .../main/java/org/apache/curator/retry/RetryUntilElapsed.java    | 2 +-
 .../src/main/java/org/apache/curator/retry/SleepingRetry.java    | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/630c009a/curator-client/src/main/java/org/apache/curator/retry/BoundedExponentialBackoffRetry.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/retry/BoundedExponentialBackoffRetry.java
b/curator-client/src/main/java/org/apache/curator/retry/BoundedExponentialBackoffRetry.java
index f31da61..3c9d3cd 100644
--- a/curator-client/src/main/java/org/apache/curator/retry/BoundedExponentialBackoffRetry.java
+++ b/curator-client/src/main/java/org/apache/curator/retry/BoundedExponentialBackoffRetry.java
@@ -45,7 +45,7 @@ public class BoundedExponentialBackoffRetry extends ExponentialBackoffRetry
     }
 
     @Override
-    protected int getSleepTimeMs(int retryCount, long elapsedTimeMs)
+    protected long getSleepTimeMs(int retryCount, long elapsedTimeMs)
     {
         return Math.min(maxSleepTimeMs, super.getSleepTimeMs(retryCount, elapsedTimeMs));
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/630c009a/curator-client/src/main/java/org/apache/curator/retry/ExponentialBackoffRetry.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/retry/ExponentialBackoffRetry.java
b/curator-client/src/main/java/org/apache/curator/retry/ExponentialBackoffRetry.java
index 1aed9a8..421e2b2 100644
--- a/curator-client/src/main/java/org/apache/curator/retry/ExponentialBackoffRetry.java
+++ b/curator-client/src/main/java/org/apache/curator/retry/ExponentialBackoffRetry.java
@@ -65,10 +65,10 @@ public class ExponentialBackoffRetry extends SleepingRetry
     }
 
     @Override
-    protected int getSleepTimeMs(int retryCount, long elapsedTimeMs)
+    protected long getSleepTimeMs(int retryCount, long elapsedTimeMs)
     {
         // copied from Hadoop's RetryPolicies.java
-        int sleepMs = baseSleepTimeMs * Math.max(1, random.nextInt(1 << (retryCount
+ 1)));
+        long sleepMs = baseSleepTimeMs * Math.max(1, random.nextInt(1 << (retryCount
+ 1)));
         if ( sleepMs > maxSleepMs )
         {
             log.warn(String.format("Sleep extension too large (%d). Pinning to %d", sleepMs,
maxSleepMs));

http://git-wip-us.apache.org/repos/asf/curator/blob/630c009a/curator-client/src/main/java/org/apache/curator/retry/RetryNTimes.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/retry/RetryNTimes.java b/curator-client/src/main/java/org/apache/curator/retry/RetryNTimes.java
index 6e0ff0e..234b241 100644
--- a/curator-client/src/main/java/org/apache/curator/retry/RetryNTimes.java
+++ b/curator-client/src/main/java/org/apache/curator/retry/RetryNTimes.java
@@ -32,7 +32,7 @@ public class RetryNTimes extends SleepingRetry
     }
 
     @Override
-    protected int getSleepTimeMs(int retryCount, long elapsedTimeMs)
+    protected long getSleepTimeMs(int retryCount, long elapsedTimeMs)
     {
         return sleepMsBetweenRetries;
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/630c009a/curator-client/src/main/java/org/apache/curator/retry/RetryUntilElapsed.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/retry/RetryUntilElapsed.java
b/curator-client/src/main/java/org/apache/curator/retry/RetryUntilElapsed.java
index cd1953c..3b11268 100644
--- a/curator-client/src/main/java/org/apache/curator/retry/RetryUntilElapsed.java
+++ b/curator-client/src/main/java/org/apache/curator/retry/RetryUntilElapsed.java
@@ -42,7 +42,7 @@ public class RetryUntilElapsed extends SleepingRetry
     }
 
     @Override
-    protected int getSleepTimeMs(int retryCount, long elapsedTimeMs)
+    protected long getSleepTimeMs(int retryCount, long elapsedTimeMs)
     {
         return sleepMsBetweenRetries;
     }

http://git-wip-us.apache.org/repos/asf/curator/blob/630c009a/curator-client/src/main/java/org/apache/curator/retry/SleepingRetry.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/retry/SleepingRetry.java b/curator-client/src/main/java/org/apache/curator/retry/SleepingRetry.java
index 6f0a1fb..22d2b33 100644
--- a/curator-client/src/main/java/org/apache/curator/retry/SleepingRetry.java
+++ b/curator-client/src/main/java/org/apache/curator/retry/SleepingRetry.java
@@ -55,5 +55,5 @@ abstract class SleepingRetry implements RetryPolicy
         return false;
     }
 
-    protected abstract int   getSleepTimeMs(int retryCount, long elapsedTimeMs);
+    protected abstract long   getSleepTimeMs(int retryCount, long elapsedTimeMs);
 }


Mime
View raw message