From d7b90b319908113bb90ae871cf4a5843bbf6bbaa Mon Sep 17 00:00:00 2001 From: Viraj Jasani Date: Fri, 25 Oct 2019 13:52:06 +0530 Subject: [PATCH] HBASE-23194 Remove unused methods from TokenUtil (#737) Signed-off-by: Peter Somogyi --- .../hbase/security/token/TokenUtil.java | 79 +++---------------- 1 file changed, 9 insertions(+), 70 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java index 159f81e8dbf0..3769d6beef36 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java @@ -19,11 +19,8 @@ import java.io.IOException; import java.lang.reflect.UndeclaredThrowableException; -import java.util.concurrent.CompletableFuture; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.client.AsyncConnection; import org.apache.hadoop.hbase.client.Connection; -import org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.zookeeper.ZKClusterId; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; @@ -42,85 +39,27 @@ */ @InterfaceAudience.Public public class TokenUtil { + // This class is referenced indirectly by User out in common; instances are created by reflection private static final Logger LOG = LoggerFactory.getLogger(TokenUtil.class); - /** - * See {@link ClientTokenUtil#obtainToken(org.apache.hadoop.hbase.client.AsyncConnection)}. - * @deprecated External users should not use this method. Please post on - * the HBase dev mailing list if you need this method. Internal - * HBase code should use {@link ClientTokenUtil} instead. - */ - @Deprecated - public static CompletableFuture> obtainToken( - AsyncConnection conn) { - return ClientTokenUtil.obtainToken(conn); - } - - /** - * See {@link ClientTokenUtil#obtainToken(org.apache.hadoop.hbase.client.Connection)}. - * @deprecated External users should not use this method. Please post on - * the HBase dev mailing list if you need this method. Internal - * HBase code should use {@link ClientTokenUtil} instead. - */ - @Deprecated - public static Token obtainToken(Connection conn) - throws IOException { - return ClientTokenUtil.obtainToken(conn); - } - - - /** - * See {@link ClientTokenUtil#toToken(org.apache.hadoop.security.token.Token)}. - * @deprecated External users should not use this method. Please post on - * the HBase dev mailing list if you need this method. Internal - * HBase code should use {@link ClientTokenUtil} instead. - */ - @Deprecated - public static AuthenticationProtos.Token toToken(Token token) { - return ClientTokenUtil.toToken(token); + private static Text getClusterId(Token token) { + return token.getService() != null + ? token.getService() : new Text("default"); } /** - * See {@link ClientTokenUtil#obtainToken(org.apache.hadoop.hbase.client.Connection, - * org.apache.hadoop.hbase.security.User)}. - * @deprecated External users should not use this method. Please post on - * the HBase dev mailing list if you need this method. Internal - * HBase code should use {@link ClientTokenUtil} instead. + * @deprecated As of HBase-3.0. Will be removed in HBase-4.0 + *

+ * See {@link ClientTokenUtil#obtainAndCacheToken(org.apache.hadoop.hbase.client.Connection, + * org.apache.hadoop.hbase.security.User)}. */ @Deprecated - public static Token obtainToken( - final Connection conn, User user) throws IOException, InterruptedException { - return ClientTokenUtil.obtainToken(conn, user); - } - - /** - * See {@link ClientTokenUtil#obtainAndCacheToken(org.apache.hadoop.hbase.client.Connection, - * org.apache.hadoop.hbase.security.User)}. - */ public static void obtainAndCacheToken(final Connection conn, - User user) - throws IOException, InterruptedException { + final User user) throws IOException, InterruptedException { ClientTokenUtil.obtainAndCacheToken(conn, user); } - /** - * See {@link ClientTokenUtil#toToken(org.apache.hadoop.security.token.Token)}. - * @deprecated External users should not use this method. Please post on - * the HBase dev mailing list if you need this method. Internal - * HBase code should use {@link ClientTokenUtil} instead. - */ - @Deprecated - public static Token toToken(AuthenticationProtos.Token proto) { - return ClientTokenUtil.toToken(proto); - } - - private static Text getClusterId(Token token) - throws IOException { - return token.getService() != null - ? token.getService() : new Text("default"); - } - /** * Obtain an authentication token on behalf of the given user and add it to * the credentials for the given map reduce job.