You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2024/04/26 15:14:12 UTC

(ratis) branch master updated: RATIS-2061. Fix setCloseThreshold parameter in RaftServerConfigKeys (#1070)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new b0ec1143c RATIS-2061. Fix setCloseThreshold parameter in RaftServerConfigKeys (#1070)
b0ec1143c is described below

commit b0ec1143c49e61525baf5da935a3509a59246883
Author: Hongbing Wang <28...@qq.com>
AuthorDate: Fri Apr 26 23:14:07 2024 +0800

    RATIS-2061. Fix setCloseThreshold parameter in RaftServerConfigKeys (#1070)
---
 .../java/org/apache/ratis/server/RaftServerConfigKeys.java | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java b/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
index 7419ca095..f6dcbaa66 100644
--- a/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
+++ b/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
@@ -77,9 +77,14 @@ public interface RaftServerConfigKeys {
     return getTimeDuration(properties.getTimeDuration(SLEEP_DEVIATION_THRESHOLD_DEFAULT.getUnit()),
         SLEEP_DEVIATION_THRESHOLD_KEY, SLEEP_DEVIATION_THRESHOLD_DEFAULT, getDefaultLog());
   }
+  /** @deprecated use {@link #setSleepDeviationThreshold(RaftProperties, TimeDuration)}. */
+  @Deprecated
   static void setSleepDeviationThreshold(RaftProperties properties, int thresholdMs) {
     setInt(properties::setInt, SLEEP_DEVIATION_THRESHOLD_KEY, thresholdMs);
   }
+  static void setSleepDeviationThreshold(RaftProperties properties, TimeDuration threshold) {
+    setTimeDuration(properties::setTimeDuration, SLEEP_DEVIATION_THRESHOLD_KEY, threshold);
+  }
 
   String CLOSE_THRESHOLD_KEY = PREFIX + ".close.threshold";
   TimeDuration CLOSE_THRESHOLD_DEFAULT = TimeDuration.valueOf(60, TimeUnit.SECONDS);
@@ -87,8 +92,13 @@ public interface RaftServerConfigKeys {
     return getTimeDuration(properties.getTimeDuration(CLOSE_THRESHOLD_DEFAULT.getUnit()),
         CLOSE_THRESHOLD_KEY, CLOSE_THRESHOLD_DEFAULT, getDefaultLog());
   }
-  static void setCloseThreshold(RaftProperties properties, int thresholdMs) {
-    setInt(properties::setInt, CLOSE_THRESHOLD_KEY, thresholdMs);
+  /** @deprecated use {@link #setCloseThreshold(RaftProperties, TimeDuration)}. */
+  @Deprecated
+  static void setCloseThreshold(RaftProperties properties, int thresholdSec) {
+    setInt(properties::setInt, CLOSE_THRESHOLD_KEY, thresholdSec);
+  }
+  static void setCloseThreshold(RaftProperties properties, TimeDuration threshold) {
+    setTimeDuration(properties::setTimeDuration, CLOSE_THRESHOLD_KEY, threshold);
   }
 
   /**