HBASE-21727 Simplify documentation around client timeout - ADDENDUM

Add back HBaseConfiguration#getInt with deprecation

Signed-off-by: zhangduo <zhangduo@apache.org>
This commit is contained in:
Peter Somogyi 2019-02-05 09:38:59 +01:00 committed by zhangduo
parent 4b2c5ae632
commit a33cda4b03
1 changed files with 26 additions and 0 deletions

View File

@ -169,6 +169,32 @@ public class HBaseConfiguration extends Configuration {
return isShowConf;
}
/**
* Get the value of the <code>name</code> property as an <code>int</code>, 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 <code>int</code>, 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 <code>int</code>, or <code>defaultValue</code>.
* @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