Add in the ability to turn off reverse DNS lookups for membership on a global scale.
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 15 Jan 2008 19:34:10 +0000 (19:34 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 15 Jan 2008 19:34:10 +0000 (19:34 +0000)
alot of system aren't configured for this, so simple debugging or warn messages that try to print the name, cause timeouts

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@612192 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/tribes/membership/MemberImpl.java

index 0e5479a..c1e5ce1 100644 (file)
@@ -37,6 +37,11 @@ import org.apache.catalina.tribes.transport.SenderState;
 public class MemberImpl implements Member, java.io.Externalizable {
 
     /**
+     * Should a call to getName or getHostName try to do a DNS lookup?
+     * default is false
+     */
+    public static final boolean DO_DNS_LOOKUPS = Boolean.parseBoolean(System.getProperty("org.apache.catalina.tribes.dns_lookups","false"));
+    /**
      * Public properties specific to this implementation
      */
     public static final transient String TCP_LISTEN_PORT = "tcpListenPort";
@@ -430,7 +435,10 @@ public class MemberImpl implements Member, java.io.Externalizable {
         if ( this.hostname != null ) return hostname;
         else {
             try {
-                this.hostname = java.net.InetAddress.getByAddress(host).getHostName();
+                if (DO_DNS_LOOKUPS)
+                    this.hostname = java.net.InetAddress.getByAddress(host).getHostName();
+                else 
+                    this.hostname = org.apache.catalina.tribes.util.Arrays.toString(host);
                 return this.hostname;
             }catch ( IOException x ) {
                 throw new RuntimeException("Unable to parse hostname.",x);