hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r826920 - /hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java
Date Tue, 20 Oct 2009 00:56:34 GMT
Author: jdcryans
Date: Tue Oct 20 00:56:33 2009
New Revision: 826920

URL: http://svn.apache.org/viewvc?rev=826920&view=rev
Log:
HBASE-1918 new version to test on Hudson

Modified:
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java?rev=826920&r1=826919&r2=826920&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HServerInfo.java Tue Oct 20 00:56:33
2009
@@ -22,6 +22,8 @@
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.hadoop.io.WritableComparable;
 
@@ -40,6 +42,7 @@
   private int infoPort;
   private String serverName = null;
   private String name;
+  private static Map<String,String> dnsCache = new HashMap<String,String>();
 
   /** default constructor - used by Writable */
   public HServerInfo() {
@@ -235,11 +238,11 @@
       String host = serverAddress.substring(0, colonIndex);
       int port =
         Integer.valueOf(serverAddress.substring(colonIndex + 1)).intValue();
-
-      HServerAddress address = new HServerAddress(serverAddress);
-      if(!address.getHostname().equals(host)) {
-        System.out.println("HBASE-1918 debug : " + address.getHostname() + " != " + host);
+      if(!dnsCache.containsKey(host)) {
+        HServerAddress address = new HServerAddress(serverAddress);
+        dnsCache.put(host, address.getHostname());
       }
+      host = dnsCache.get(host);
       name = getServerName(host, port, startCode);
     }
     return name;



Mime
View raw message