This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
     new 111f3a6b CURATOR-262. Fix sleepMs overflow (#490)
111f3a6b is described below

commit 111f3a6bdcd562db0493e52243e5cec933cc36ef
Author: shenjianeng <[email protected]>
AuthorDate: Wed Dec 20 12:44:37 2023 +0800

    CURATOR-262. Fix sleepMs overflow (#490)
    
    Co-authored-by: shenjianeng <[email protected]>
---
 .../src/main/java/org/apache/curator/retry/ExponentialBackoffRetry.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 929b3b37..44aac9bd 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
@@ -64,7 +64,7 @@ public class ExponentialBackoffRetry extends SleepingRetry {
     @Override
     protected long getSleepTimeMs(int retryCount, long elapsedTimeMs) {
         // copied from Hadoop's RetryPolicies.java
-        long sleepMs = baseSleepTimeMs * Math.max(1, random.nextInt(1 << 
(retryCount + 1)));
+        long sleepMs = (long) 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));
             sleepMs = maxSleepMs;

Reply via email to