[hbase] 02/10: HBASE-21516 Use AsyncConnection instead of Connection in SecureBulkLoadManager
This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch HBASE-21512 in repository https://gitbox.apache.org/repos/asf/hbase.git commit 66e033b8e378625cd250f326c4374edd7c9e7aaf Author: zhangduo AuthorDate: Sat Dec 1 21:15:48 2018 +0800 HBASE-21516 Use AsyncConnection instead of Connection in SecureBulkLoadManager --- .../apache/hadoop/hbase/protobuf/ProtobufUtil.java | 5 +- .../hadoop/hbase/shaded/protobuf/ProtobufUtil.java | 7 ++- .../hadoop/hbase/regionserver/HRegionServer.java | 2 +- .../hbase/regionserver/SecureBulkLoadManager.java | 24 - .../hadoop/hbase/security/token/TokenUtil.java | 57 +- .../hadoop/hbase/security/token/TestTokenUtil.java | 42 6 files changed, 96 insertions(+), 41 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index a3d49b5..d9e620b 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -261,13 +261,12 @@ public final class ProtobufUtil { * just {@link ServiceException}. Prefer this method to * {@link #getRemoteException(ServiceException)} because trying to * contain direct protobuf references. - * @param e */ - public static IOException handleRemoteException(Exception e) { + public static IOException handleRemoteException(Throwable e) { return makeIOExceptionOfException(e); } - private static IOException makeIOExceptionOfException(Exception e) { + private static IOException makeIOExceptionOfException(Throwable e) { Throwable t = e; if (e instanceof ServiceException || e instanceof org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) { diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java index fea81f1..de2fb7d 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java @@ -40,7 +40,6 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Collectors; - import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.ByteBufferExtendedCell; @@ -123,6 +122,7 @@ import org.apache.hbase.thirdparty.com.google.protobuf.Service; import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException; import org.apache.hbase.thirdparty.com.google.protobuf.TextFormat; import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations; + import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService; import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CloseRegionRequest; import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetOnlineRegionRequest; @@ -343,13 +343,12 @@ public final class ProtobufUtil { * just {@link ServiceException}. Prefer this method to * {@link #getRemoteException(ServiceException)} because trying to * contain direct protobuf references. - * @param e */ - public static IOException handleRemoteException(Exception e) { + public static IOException handleRemoteException(Throwable e) { return makeIOExceptionOfException(e); } - private static IOException makeIOExceptionOfException(Exception e) { + private static IOException makeIOExceptionOfException(Throwable e) { Throwable t = e; if (e instanceof ServiceException) { t = e.getCause(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index dbc5e77..2e54907 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1937,7 +1937,7 @@ public class HRegionServer extends HasThread implements if (!isStopped() && !isAborted()) { initializeThreads(); } -this.secureBulkLoadManager = new SecureBulkLoadManager(this.conf, clusterConnection); +this.secureBulkLoadManager = new SecureBulkLoadManager(this.conf, asyncClusterConnection); this.secureBulkLoadManager.start(); // Health checker thread. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java index 566a6b6..add6519 100644 ---
[hbase] 02/10: HBASE-21516 Use AsyncConnection instead of Connection in SecureBulkLoadManager
This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch HBASE-21512 in repository https://gitbox.apache.org/repos/asf/hbase.git commit 462f341d9f4500d3bcdab2d0f2187b191b6bccba Author: zhangduo AuthorDate: Sat Dec 1 21:15:48 2018 +0800 HBASE-21516 Use AsyncConnection instead of Connection in SecureBulkLoadManager --- .../apache/hadoop/hbase/protobuf/ProtobufUtil.java | 5 +- .../hadoop/hbase/shaded/protobuf/ProtobufUtil.java | 7 ++- .../hadoop/hbase/regionserver/HRegionServer.java | 2 +- .../hbase/regionserver/SecureBulkLoadManager.java | 24 - .../hadoop/hbase/security/token/TokenUtil.java | 57 +- .../hadoop/hbase/security/token/TestTokenUtil.java | 42 6 files changed, 96 insertions(+), 41 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index a3d49b5..d9e620b 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -261,13 +261,12 @@ public final class ProtobufUtil { * just {@link ServiceException}. Prefer this method to * {@link #getRemoteException(ServiceException)} because trying to * contain direct protobuf references. - * @param e */ - public static IOException handleRemoteException(Exception e) { + public static IOException handleRemoteException(Throwable e) { return makeIOExceptionOfException(e); } - private static IOException makeIOExceptionOfException(Exception e) { + private static IOException makeIOExceptionOfException(Throwable e) { Throwable t = e; if (e instanceof ServiceException || e instanceof org.apache.hbase.thirdparty.com.google.protobuf.ServiceException) { diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java index fea81f1..de2fb7d 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java @@ -40,7 +40,6 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Collectors; - import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.ByteBufferExtendedCell; @@ -123,6 +122,7 @@ import org.apache.hbase.thirdparty.com.google.protobuf.Service; import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException; import org.apache.hbase.thirdparty.com.google.protobuf.TextFormat; import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations; + import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService; import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.CloseRegionRequest; import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetOnlineRegionRequest; @@ -343,13 +343,12 @@ public final class ProtobufUtil { * just {@link ServiceException}. Prefer this method to * {@link #getRemoteException(ServiceException)} because trying to * contain direct protobuf references. - * @param e */ - public static IOException handleRemoteException(Exception e) { + public static IOException handleRemoteException(Throwable e) { return makeIOExceptionOfException(e); } - private static IOException makeIOExceptionOfException(Exception e) { + private static IOException makeIOExceptionOfException(Throwable e) { Throwable t = e; if (e instanceof ServiceException) { t = e.getCause(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index dbc5e77..2e54907 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1937,7 +1937,7 @@ public class HRegionServer extends HasThread implements if (!isStopped() && !isAborted()) { initializeThreads(); } -this.secureBulkLoadManager = new SecureBulkLoadManager(this.conf, clusterConnection); +this.secureBulkLoadManager = new SecureBulkLoadManager(this.conf, asyncClusterConnection); this.secureBulkLoadManager.start(); // Health checker thread. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SecureBulkLoadManager.java index 566a6b6..add6519 100644 ---