Apache9 commented on code in PR #1822:
URL:
https://github.com/apache/incubator-pegasus/pull/1822#discussion_r1440490341
##########
java-client/src/main/java/org/apache/pegasus/client/retry/DefaultRetryPolicy.java:
##########
@@ -0,0 +1,29 @@
+package org.apache.pegasus.client.retry;
+
+import java.time.Duration;
+import java.util.concurrent.TimeUnit;
+import org.apache.pegasus.client.ClientOptions;
+
+/**
+ * The default retry policy, which is the only policy before we introduce the
retry policy
+ * mechanism. It only considers the timeout value to calculate the retry
delay, that's why\ we need
Review Comment:
Why there is '\' after the 'why' word? Typo?
##########
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...
--
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]