tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject svn commit: r620845 - in /tomcat/trunk/java/org/apache/catalina: Server.java core/StandardServer.java startup/Catalina.java
Date Tue, 12 Feb 2008 16:23:01 GMT
Author: jfclere
Date: Tue Feb 12 08:22:58 2008
New Revision: 620845

URL: http://svn.apache.org/viewvc?rev=620845&view=rev
Log:
Allow to run the shutdown on another IP that localhost.

Modified:
    tomcat/trunk/java/org/apache/catalina/Server.java
    tomcat/trunk/java/org/apache/catalina/core/StandardServer.java
    tomcat/trunk/java/org/apache/catalina/startup/Catalina.java

Modified: tomcat/trunk/java/org/apache/catalina/Server.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Server.java?rev=620845&r1=620844&r2=620845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Server.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Server.java Tue Feb 12 08:22:58 2008
@@ -89,6 +89,20 @@
 
 
     /**
+     * Return the address on which we listen to for shutdown commands.
+     */
+    public String getAddress();
+
+
+    /**
+     * Set the address on which we listen to for shutdown commands.
+     *
+     * @param address The new address
+     */
+    public void setAddress(String address);
+
+
+    /**
      * Return the shutdown command string we are waiting for.
      */
     public String getShutdown();

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardServer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardServer.java?rev=620845&r1=620844&r2=620845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardServer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardServer.java Tue Feb 12 08:22:58 2008
@@ -137,6 +137,11 @@
      */
     private int port = 8005;
 
+    /**
+     * The address on which we wait for shutdown commands.
+     */
+    private String address = "127.0.0.1";
+
 
     /**
      * A random number generator that is <strong>only</strong> used if
@@ -281,6 +286,27 @@
 
 
     /**
+     * Return the address on which we listen to for shutdown commands.
+     */
+    public String getAddress() {
+
+        return (this.address);
+
+    }
+
+
+    /**
+     * Set the address on which we listen to for shutdown commands.
+     *
+     * @param address The new address
+     */
+    public void setAddress(String address) {
+
+        this.address = address;
+
+    }
+
+    /**
      * Return the shutdown command string we are waiting for.
      */
     public String getShutdown() {
@@ -372,9 +398,10 @@
         try {
             serverSocket =
                 new ServerSocket(port, 1,
-                                 InetAddress.getByName("127.0.0.1"));
+                                 InetAddress.getByName(address));
         } catch (IOException e) {
             log.error("StandardServer.await: create[" + port
+                               + ":" + address
                                + "]: ", e);
             System.exit(1);
         }

Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=620845&r1=620844&r2=620845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Tue Feb 12 08:22:58 2008
@@ -416,7 +416,7 @@
 
         // Stop the existing server
         try {
-            Socket socket = new Socket("127.0.0.1", server.getPort());
+            Socket socket = new Socket(server.getAddress(), server.getPort());
             OutputStream stream = socket.getOutputStream();
             String shutdown = server.getShutdown();
             for (int i = 0; i < shutdown.length(); i++)



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


Mime
View raw message