[hbase] 05/06: HBASE-23648: Re-use underlying connection registry in RawAsyncHBaseAdmin (#994)

2020-01-24 Thread ndimiduk
This is an automated email from the ASF dual-hosted git repository.

ndimiduk pushed a commit to branch HBASE-18095/client-locate-meta-no-zookeeper
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 07c38260f51ac2ef09008980a95e052ba0a1c22b
Author: Bharath Vissapragada 
AuthorDate: Thu Jan 9 12:27:09 2020 -0800

HBASE-23648: Re-use underlying connection registry in RawAsyncHBaseAdmin 
(#994)

* HBASE-23648: Re-use underlying connection registry in RawAsyncHBaseAdmin

No need to create and close a new registry on demand. Audited other
usages of getRegistry() and the code looks fine.

* Fix checkstyle issues in RawAsyncHBaseAdmin
---
 .../hadoop/hbase/client/RawAsyncHBaseAdmin.java| 110 +
 1 file changed, 47 insertions(+), 63 deletions(-)

diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
index 3e5bea3..69bd611 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -21,7 +21,6 @@ import static org.apache.hadoop.hbase.HConstants.HIGH_QOS;
 import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME;
 import static org.apache.hadoop.hbase.util.FutureUtils.addListener;
 import static 
org.apache.hadoop.hbase.util.FutureUtils.unwrapCompletionException;
-
 import com.google.protobuf.Message;
 import com.google.protobuf.RpcChannel;
 import java.io.IOException;
@@ -46,7 +45,6 @@ import java.util.function.Supplier;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import org.apache.commons.io.IOUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.AsyncMetaTableAccessor;
 import org.apache.hadoop.hbase.CacheEvictionStats;
@@ -99,14 +97,12 @@ import org.apache.hadoop.hbase.util.ForeignExceptionUtil;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
 import org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
 import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
 import org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer;
 import org.apache.hbase.thirdparty.io.netty.util.Timeout;
 import org.apache.hbase.thirdparty.io.netty.util.TimerTask;
-
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.RequestConverter;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos;
@@ -755,7 +751,8 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
   }
 
   @Override
-  public CompletableFuture addColumnFamily(TableName tableName, 
ColumnFamilyDescriptor columnFamily) {
+  public CompletableFuture addColumnFamily(
+  TableName tableName, ColumnFamilyDescriptor columnFamily) {
 return this. procedureCall(tableName,
   RequestConverter.buildAddColumnRequest(tableName, columnFamily, 
ng.getNonceGroup(),
 ng.newNonce()), (s, c, req, done) -> s.addColumn(c, req, done), (resp) 
-> resp.getProcId(),
@@ -809,10 +806,10 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
 . newMasterCaller()
 .action(
   (controller, stub) -> this
-  . call(
-controller, stub, 
RequestConverter.buildGetNamespaceDescriptorRequest(name), (s, c,
-req, done) -> s.getNamespaceDescriptor(c, req, done), 
(resp) -> ProtobufUtil
-
.toNamespaceDescriptor(resp.getNamespaceDescriptor(.call();
+  .
+  call(controller, stub, 
RequestConverter.buildGetNamespaceDescriptorRequest(name),
+(s, c, req, done) -> s.getNamespaceDescriptor(c, req, 
done), (resp)
+  -> 
ProtobufUtil.toNamespaceDescriptor(resp.getNamespaceDescriptor(.call();
   }
 
   @Override
@@ -830,13 +827,12 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
   @Override
   public CompletableFuture> 
listNamespaceDescriptors() {
 return this
-.> newMasterCaller()
-.action(
-  (controller, stub) -> this
-  .> call(
-controller, stub, 
ListNamespaceDescriptorsRequest.newBuilder().build(), (s, c, req,
-done) -> s.listNamespaceDescriptors(c, req, done), (resp) 
-> ProtobufUtil
-.toNamespaceDescriptorList(resp))).call();
+.> newMasterCaller().action((controller, 
stub) -> this
+  .> call(controller, stub,
+  

[hbase] 05/06: HBASE-23648: Re-use underlying connection registry in RawAsyncHBaseAdmin (#994)

2020-01-14 Thread ndimiduk
This is an automated email from the ASF dual-hosted git repository.

ndimiduk pushed a commit to branch HBASE-18095/client-locate-meta-no-zookeeper
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 49fb4518eb87d3b7ab57d8f92f14a0da1ea8cbd3
Author: Bharath Vissapragada 
AuthorDate: Thu Jan 9 12:27:09 2020 -0800

HBASE-23648: Re-use underlying connection registry in RawAsyncHBaseAdmin 
(#994)

* HBASE-23648: Re-use underlying connection registry in RawAsyncHBaseAdmin

No need to create and close a new registry on demand. Audited other
usages of getRegistry() and the code looks fine.

* Fix checkstyle issues in RawAsyncHBaseAdmin
---
 .../hadoop/hbase/client/RawAsyncHBaseAdmin.java| 110 +
 1 file changed, 47 insertions(+), 63 deletions(-)

diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
index 75324c9..fb9d150 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -21,7 +21,6 @@ import static org.apache.hadoop.hbase.HConstants.HIGH_QOS;
 import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME;
 import static org.apache.hadoop.hbase.util.FutureUtils.addListener;
 import static 
org.apache.hadoop.hbase.util.FutureUtils.unwrapCompletionException;
-
 import com.google.protobuf.Message;
 import com.google.protobuf.RpcChannel;
 import java.io.IOException;
@@ -46,7 +45,6 @@ import java.util.function.Supplier;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import org.apache.commons.io.IOUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.AsyncMetaTableAccessor;
 import org.apache.hadoop.hbase.CacheEvictionStats;
@@ -99,14 +97,12 @@ import org.apache.hadoop.hbase.util.ForeignExceptionUtil;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
 import org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
 import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
 import org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer;
 import org.apache.hbase.thirdparty.io.netty.util.Timeout;
 import org.apache.hbase.thirdparty.io.netty.util.TimerTask;
-
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.RequestConverter;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos;
@@ -749,7 +745,8 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
   }
 
   @Override
-  public CompletableFuture addColumnFamily(TableName tableName, 
ColumnFamilyDescriptor columnFamily) {
+  public CompletableFuture addColumnFamily(
+  TableName tableName, ColumnFamilyDescriptor columnFamily) {
 return this. procedureCall(tableName,
   RequestConverter.buildAddColumnRequest(tableName, columnFamily, 
ng.getNonceGroup(),
 ng.newNonce()), (s, c, req, done) -> s.addColumn(c, req, done), (resp) 
-> resp.getProcId(),
@@ -803,10 +800,10 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
 . newMasterCaller()
 .action(
   (controller, stub) -> this
-  . call(
-controller, stub, 
RequestConverter.buildGetNamespaceDescriptorRequest(name), (s, c,
-req, done) -> s.getNamespaceDescriptor(c, req, done), 
(resp) -> ProtobufUtil
-
.toNamespaceDescriptor(resp.getNamespaceDescriptor(.call();
+  .
+  call(controller, stub, 
RequestConverter.buildGetNamespaceDescriptorRequest(name),
+(s, c, req, done) -> s.getNamespaceDescriptor(c, req, 
done), (resp)
+  -> 
ProtobufUtil.toNamespaceDescriptor(resp.getNamespaceDescriptor(.call();
   }
 
   @Override
@@ -824,13 +821,12 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
   @Override
   public CompletableFuture> 
listNamespaceDescriptors() {
 return this
-.> newMasterCaller()
-.action(
-  (controller, stub) -> this
-  .> call(
-controller, stub, 
ListNamespaceDescriptorsRequest.newBuilder().build(), (s, c, req,
-done) -> s.listNamespaceDescriptors(c, req, done), (resp) 
-> ProtobufUtil
-.toNamespaceDescriptorList(resp))).call();
+.> newMasterCaller().action((controller, 
stub) -> this
+  .> call(controller, stub,
+