From a25133a73bba78e727afdc95f68f209ba108154a Mon Sep 17 00:00:00 2001 From: Jurriaan Mous Date: Sun, 1 May 2016 13:33:00 +0200 Subject: [PATCH] HBASE-15744 --- .../hadoop/hbase/client/RpcRetryingCaller.java | 2 +- .../client/RpcRetryingCallerWithReadReplicas.java | 9 +----- .../org/apache/hadoop/hbase/ipc/RpcClient.java | 37 +++++++++++----------- .../hadoop/hbase/client/TestFromClientSide.java | 2 +- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java index 807c227..b4cd2ef 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java @@ -43,7 +43,7 @@ public interface RpcRetryingCaller { /** * Call the server once only. - * {@link RetryingCallable} has a strange shape so we can do retrys. Use this invocation if you + * {@link RetryingCallable} has a strange shape so we can do retries. Use this invocation if you * want to do a single call only (A call to {@link RetryingCallable#call(int)} will not likely * succeed). * @return an object of type T diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java index f4e2614..425d314 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java @@ -1,5 +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 @@ -16,8 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.hadoop.hbase.client; @@ -297,11 +294,7 @@ public class RpcRetryingCallerWithReadReplicas { } else { rl = cConnection.locateRegion(tableName, row, useCache, true, replicaId); } - } catch (DoNotRetryIOException e) { - throw e; - } catch (RetriesExhaustedException e) { - throw e; - } catch (InterruptedIOException e) { + } catch (DoNotRetryIOException | InterruptedIOException | RetriesExhaustedException e) { throw e; } catch (IOException e) { throw new RetriesExhaustedException("Can't get the location", e); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java index 540e224..c3f4d02 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java @@ -29,29 +29,29 @@ import java.io.IOException; * Interface for RpcClient implementations so ConnectionManager can handle it. */ @InterfaceAudience.Private public interface RpcClient extends Closeable { - public final static String FAILED_SERVER_EXPIRY_KEY = "hbase.ipc.client.failed.servers.expiry"; - public final static int FAILED_SERVER_EXPIRY_DEFAULT = 2000; - public final static String IDLE_TIME = "hbase.ipc.client.connection.minIdleTimeBeforeClose"; - public static final String IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY = + String FAILED_SERVER_EXPIRY_KEY = "hbase.ipc.client.failed.servers.expiry"; + int FAILED_SERVER_EXPIRY_DEFAULT = 2000; + String IDLE_TIME = "hbase.ipc.client.connection.minIdleTimeBeforeClose"; + String IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY = "hbase.ipc.client.fallback-to-simple-auth-allowed"; - public static final boolean IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT = false; - public static final String SPECIFIC_WRITE_THREAD = "hbase.ipc.client.specificThreadForWriting"; - public static final String DEFAULT_CODEC_CLASS = "hbase.client.default.rpc.codec"; + boolean IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT = false; + String SPECIFIC_WRITE_THREAD = "hbase.ipc.client.specificThreadForWriting"; + String DEFAULT_CODEC_CLASS = "hbase.client.default.rpc.codec"; - public final static String SOCKET_TIMEOUT_CONNECT = "hbase.ipc.client.socket.timeout.connect"; + String SOCKET_TIMEOUT_CONNECT = "hbase.ipc.client.socket.timeout.connect"; /** * How long we wait when we wait for an answer. It's not the operation time, it's the time * we wait when we start to receive an answer, when the remote write starts to send the data. */ - public final static String SOCKET_TIMEOUT_READ = "hbase.ipc.client.socket.timeout.read"; - public final static String SOCKET_TIMEOUT_WRITE = "hbase.ipc.client.socket.timeout.write"; - public final static int DEFAULT_SOCKET_TIMEOUT_CONNECT = 10000; // 10 seconds - public final static int DEFAULT_SOCKET_TIMEOUT_READ = 20000; // 20 seconds - public final static int DEFAULT_SOCKET_TIMEOUT_WRITE = 60000; // 60 seconds + String SOCKET_TIMEOUT_READ = "hbase.ipc.client.socket.timeout.read"; + String SOCKET_TIMEOUT_WRITE = "hbase.ipc.client.socket.timeout.write"; + int DEFAULT_SOCKET_TIMEOUT_CONNECT = 10000; // 10 seconds + int DEFAULT_SOCKET_TIMEOUT_READ = 20000; // 20 seconds + int DEFAULT_SOCKET_TIMEOUT_WRITE = 60000; // 60 seconds // Used by the server, for compatibility with old clients. // The client in 0.99+ does not ping the server. - final static int PING_CALL_ID = -1; + int PING_CALL_ID = -1; /** * Creates a "channel" that can be used by a blocking protobuf service. Useful setting up @@ -64,8 +64,8 @@ import java.io.IOException; * @return A blocking rpc channel that goes via this rpc client instance. * @throws IOException when channel could not be created */ - public BlockingRpcChannel createBlockingRpcChannel(ServerName sn, User user, - int rpcTimeout) throws IOException; + BlockingRpcChannel createBlockingRpcChannel(ServerName sn, User user, int rpcTimeout) + throws IOException; /** * Interrupt the connections to the given server. This should be called if the server @@ -76,13 +76,14 @@ import java.io.IOException; * safe exception. * @param sn server location to cancel connections of */ - public void cancelConnections(ServerName sn); + void cancelConnections(ServerName sn); /** * Stop all threads related to this client. No further calls may be made * using this client. */ - @Override public void close(); + @Override + void close(); /** * @return true when this client uses a {@link org.apache.hadoop.hbase.codec.Codec} and so diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java index 3549791..d24118f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java @@ -5430,7 +5430,7 @@ public class TestFromClientSide { table.put(put); } - // nomal scan + // normal scan ResultScanner scanner = table.getScanner(new Scan()); int count = 0; for (Result r : scanner) { -- 2.6.4 (Apple Git-63)