You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/04/27 09:33:05 UTC

[GitHub] [incubator-ratis] lokeshj1703 commented on a change in pull request #63: RATIS-882. Implement ExponentialBackoffRetry.

lokeshj1703 commented on a change in pull request #63:
URL: https://github.com/apache/incubator-ratis/pull/63#discussion_r415659683



##########
File path: ratis-common/src/main/java/org/apache/ratis/retry/ExponentialBackoffRetry.java
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ratis.retry;
+
+import org.apache.ratis.util.Preconditions;
+import org.apache.ratis.util.TimeDuration;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Retry Policy exponentially increases sleep time with randomness on successive
+ * retries. The sleep time is a geometric progression b*2, b*4, b*8, b*16...
+ * bounded by maximum configured duration.
+ *
+ * If sleep time calculated using the progression is s then randomness is added
+ * in the range [s*0.5, s*1.5).
+ */

Review comment:
       "The sleep time is a geometric progression b*2, b*4, b*8, b*16... bounded by maximum configured duration." captures the description for maximum duration.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org