From b9f76507df0d59c69ac07c1b2308bf0e9ff00a5e 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 --- .../hadoop/hbase/HBaseConfiguration.java | 30 +++++++++++++++++++ 1 file changed, 30 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 8d8b7accc6..af5da6f949 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 @@ -169,6 +169,36 @@ 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 -- 2.20.1