From 48e86757285e22be215315ba4426bd69fc80c50f Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Tue, 5 Feb 2019 09:38:59 +0100 Subject: [PATCH] HBASE-21727 Simplify documentation around client timeout - ADDENDUM Add back HBaseConfiguration#getInt with deprecation Signed-off-by: zhangduo --- .../hadoop/hbase/HBaseConfiguration.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java index c984aeb1118..d9653c2db8d 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java @@ -171,6 +171,32 @@ public class HBaseConfiguration extends Configuration { return isShowConf; } + /** + * Get the value of the name property as an int, possibly referring to + * the deprecated name of the configuration property. If no such property exists, the provided + * default value is returned, or if the specified value is not a valid int, then an + * error is thrown. + * @param name property name. + * @param deprecatedName a deprecatedName for the property to use if non-deprecated name is not + * used + * @param defaultValue default value. + * @throws NumberFormatException when the value is invalid + * @return property value as an int, or defaultValue. + * @deprecated it will be removed in 3.0.0. Use + * {@link Configuration#addDeprecation(String, String)} instead. + */ + @Deprecated + public static int getInt(Configuration conf, String name, + String deprecatedName, int defaultValue) { + if (conf.get(deprecatedName) != null) { + LOG.warn(String.format("Config option \"%s\" is deprecated. Instead, use \"%s\"" + , deprecatedName, name)); + return conf.getInt(deprecatedName, defaultValue); + } else { + return conf.getInt(name, defaultValue); + } + } + /** * Get the password from the Configuration instance using the * getPassword method if it exists. If not, then fall back to the