You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pe...@apache.org on 2007/04/05 11:33:09 UTC

svn commit: r525778 - /tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java

Author: pero
Date: Thu Apr  5 02:33:09 2007
New Revision: 525778

URL: http://svn.apache.org/viewvc?view=rev&rev=525778
Log:
convert hostnames to address at tcpListenAddress attribute

Modified:
    tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java

Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java?view=diff&rev=525778&r1=525777&r2=525778
==============================================================================
--- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java (original)
+++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java Thu Apr  5 02:33:09 2007
@@ -117,10 +117,6 @@
     public java.net.InetAddress getBind() {
         if (bind == null) {
             try {
-                if ("auto".equals(tcpListenAddress)) {
-                    tcpListenAddress = java.net.InetAddress.getLocalHost()
-                            .getHostAddress();
-                }
                 if (log.isDebugEnabled())
                     log.debug("Starting replication listener on address:"
                             + tcpListenAddress);
@@ -196,13 +192,38 @@
         this.sendAck = sendAck;
     }
  
+    /**
+     * get tcp listen recevier ip address
+     * @return listen address
+     */
     public String getTcpListenAddress() {
         return tcpListenAddress;
     }
-    
+
+    /**
+     * Set TCP listen ip address. If arg auto use InetAddress.getLocalHost()
+     * otherwise arg converted with InetAddress.getByName().
+     * 
+     * @param tcpListenAddress 
+     */
     public void setTcpListenAddress(String tcpListenAddress) {
-        this.tcpListenAddress = tcpListenAddress;
+        try {
+            if ("auto".equals(tcpListenAddress)) {
+                this.tcpListenAddress = 
+                    java.net.InetAddress.getLocalHost().getHostAddress();
+            } else {
+                this.tcpListenAddress =
+                    java.net.InetAddress.getByName(tcpListenAddress).getHostAddress();
+            }
+            if (log.isDebugEnabled())
+                log.debug("Set replication listener on address:"
+                        + this.tcpListenAddress);
+        } catch (IOException ioe) {
+            log.error("Failed get Inet address at replication listener on address:"
+                    + tcpListenAddress, ioe);
+        }
     }
+
     
     public int getTcpListenPort() {
         return tcpListenPort;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org