You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2013/05/29 19:58:00 UTC

svn commit: r1487574 - /hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java

Author: tedyu
Date: Wed May 29 17:58:00 2013
New Revision: 1487574

URL: http://svn.apache.org/r1487574
Log:
HBASE-8639 very poor performance of htable#getscanner in multithreaded environment (Ted Yu)


Modified:
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java?rev=1487574&r1=1487573&r2=1487574&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java (original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java Wed May 29 17:58:00 2013
@@ -68,6 +68,14 @@ public class ScannerCallable extends Ser
   private ScanMetrics scanMetrics;
   private boolean logScannerActivity = false;
   private int logCutOffLatency = 1000;
+  private static String myAddress;
+  static {
+    try {
+      myAddress = DNS.getDefaultHost("default", "default");
+    } catch (UnknownHostException uhe) {
+      LOG.error("cannot determine my address", uhe);
+    }
+  }
 
   // indicate if it is a remote server call
   private boolean isRegionServerRemote = true;
@@ -116,10 +124,8 @@ public class ScannerCallable extends Ser
   /**
    * compare the local machine hostname with region server's hostname
    * to decide if hbase client connects to a remote region server
-   * @throws UnknownHostException.
    */
-  private void checkIfRegionServerIsRemote() throws UnknownHostException {
-    String myAddress = DNS.getDefaultHost("default", "default");
+  private void checkIfRegionServerIsRemote() {
     if (this.location.getHostname().equalsIgnoreCase(myAddress)) {
       isRegionServerRemote = false;
     } else {