hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1574772 - in /hbase/branches/0.98/hbase-client/src: main/java/org/apache/hadoop/hbase/client/ test/java/org/apache/hadoop/hbase/client/
Date Thu, 06 Mar 2014 05:31:52 GMT
Author: apurtell
Date: Thu Mar  6 05:31:52 2014
New Revision: 1574772

URL: http://svn.apache.org/r1574772
Log:
HBASE-9990 HTable uses the conf for each newCaller (Nicolas Liochon)

Modified:
    hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java
    hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java
    hbase/branches/0.98/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java

Modified: hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java?rev=1574772&r1=1574771&r2=1574772&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java
(original)
+++ hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java
Thu Mar  6 05:31:52 2014
@@ -29,7 +29,6 @@ import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.ipc.RpcClient;
@@ -65,15 +64,9 @@ public class RpcRetryingCaller<T> {
   private final long pause;
   private final int retries;
 
-  public RpcRetryingCaller(Configuration conf) {
-    this.pause = conf.getLong(HConstants.HBASE_CLIENT_PAUSE,
-      HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
-    this.retries =
-        conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
-          HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
-    this.callTimeout = conf.getInt(
-        HConstants.HBASE_CLIENT_OPERATION_TIMEOUT,
-        HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT);
+  public RpcRetryingCaller(long pause, int retries) {
+    this.pause = pause;
+    this.retries = retries;
   }
 
   private void beforeCall() {

Modified: hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java?rev=1574772&r1=1574771&r2=1574772&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java
(original)
+++ hbase/branches/0.98/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerFactory.java
Thu Mar  6 05:31:52 2014
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hbase.client;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.util.ReflectionUtils;
 
 /**
@@ -28,13 +29,21 @@ public class RpcRetryingCallerFactory {
   /** Configuration key for a custom {@link RpcRetryingCaller} */
   public static final String CUSTOM_CALLER_CONF_KEY = "hbase.rpc.callerfactory.class";
   protected final Configuration conf;
+  private final long pause;
+  private final int retries;
 
   public RpcRetryingCallerFactory(Configuration conf) {
     this.conf = conf;
+    pause = conf.getLong(HConstants.HBASE_CLIENT_PAUSE,
+        HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
+    retries = conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
+        HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
   }
 
   public <T> RpcRetryingCaller<T> newCaller() {
-    return new RpcRetryingCaller<T>(conf);
+    // We store the values in the factory instance. This way, constructing new objects
+    //  is cheap as it does not require parsing a complex structure.
+    return new RpcRetryingCaller<T>(pause, retries);
   }
 
   public static RpcRetryingCallerFactory instantiate(Configuration configuration) {
@@ -44,4 +53,4 @@ public class RpcRetryingCallerFactory {
     return ReflectionUtils.instantiateWithCustomCtor(rpcCallerFactoryClazz,
       new Class[] { Configuration.class }, new Object[] { configuration });
   }
-}
\ No newline at end of file
+}

Modified: hbase/branches/0.98/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java?rev=1574772&r1=1574771&r2=1574772&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java
(original)
+++ hbase/branches/0.98/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncProcess.java
Thu Mar  6 05:31:52 2014
@@ -106,7 +106,7 @@ public class TestAsyncProcess {
     protected RpcRetryingCaller<MultiResponse> createCaller(MultiServerCallable<Row>
callable) {
       final MultiResponse mr = createMultiResponse(callable.getLocation(), callable.getMulti(),
           nbMultiResponse, nbActions);
-      return new RpcRetryingCaller<MultiResponse>(conf) {
+      return new RpcRetryingCaller<MultiResponse>(100, 10) {
         @Override
         public MultiResponse callWithoutRetries( RetryingCallable<MultiResponse> callable)
         throws IOException, RuntimeException {



Mime
View raw message