Samunroyu commented on code in PR #1822:
URL: 
https://github.com/apache/incubator-pegasus/pull/1822#discussion_r1462678010


##########
java-client/src/main/java/org/apache/pegasus/client/retry/ExponentialBackoffRetryPolicy.java:
##########
@@ -0,0 +1,40 @@
+package org.apache.pegasus.client.retry;
+
+import java.time.Duration;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
+import org.apache.pegasus.client.ClientOptions;
+
+/** A retry policy which generates retry interval with exponential backoff 
policy. */
+public class ExponentialBackoffRetryPolicy implements RetryPolicy {
+
+  private static final int[] RETRY_BACKOFF = {1, 2, 3, 5, 10, 20, 40, 100, 
100, 100, 100, 200, 200};
+
+  private final long retryBaseIntervalMs;
+
+  private final int retryMaxTimes;
+
+  public ExponentialBackoffRetryPolicy(ClientOptions opts) {
+    this.retryBaseIntervalMs = opts.getRetryBaseInterval().toMillis();

Review Comment:
   > Better to add some comments and also some checks when setting retry base 
interval, as here we will convert the timeout to milliseconds, if user specify 
an interval less than 1 millisecond, we will not perform as expected...
   
   sure. if user specify an interval less than 1 millisecond, it will set to 
defaultintervalms.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to