Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-03-25 02:58:19 +0000
committerGreg Wilkins2015-03-25 02:58:19 +0000
commit8c652fd5bd0dcc067f225bd71b079bc0260fd578 (patch)
treebd2475c6fbad4032829237f186f12c273dfbad5a /jetty-start
parent1dc66b72dd3788c1903e55cf1c8afcb2d4f7d343 (diff)
downloadorg.eclipse.jetty.project-8c652fd5bd0dcc067f225bd71b079bc0260fd578.tar.gz
org.eclipse.jetty.project-8c652fd5bd0dcc067f225bd71b079bc0260fd578.tar.xz
org.eclipse.jetty.project-8c652fd5bd0dcc067f225bd71b079bc0260fd578.zip
462546 - ShutdownMonitor should bind to jetty.host
Added STOP.HOST system property. jetty.host is specific to a connector and a server may listen to many hosts
Diffstat (limited to 'jetty-start')
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/Main.java27
-rw-r--r--jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt4
2 files changed, 18 insertions, 13 deletions
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
index 9f2de829a0..e1faf56e6b 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
@@ -824,6 +824,7 @@ public class Main
private void doStop(StartArgs args)
{
+ String stopHost = args.getProperties().getString("STOP.HOST");
int stopPort = Integer.parseInt(args.getProperties().getString("STOP.PORT"));
String stopKey = args.getProperties().getString("STOP.KEY");
@@ -831,41 +832,41 @@ public class Main
{
int stopWait = Integer.parseInt(args.getProperties().getString("STOP.WAIT"));
- stop(stopPort,stopKey,stopWait);
+ stop(stopHost,stopPort,stopKey,stopWait);
}
else
{
- stop(stopPort,stopKey);
+ stop(stopHost,stopPort,stopKey);
}
}
/**
* Stop a running jetty instance.
*/
- public void stop(int port, String key)
+ public void stop(String host, int port, String key)
{
- stop(port,key,0);
+ stop(host,port,key,0);
}
- public void stop(int port, String key, int timeout)
+ public void stop(String host, int port, String key, int timeout)
{
- int _port = port;
- String _key = key;
-
+ if (host==null || host.length()==0)
+ host="127.0.0.1";
+
try
{
- if (_port <= 0)
+ if (port <= 0)
{
System.err.println("STOP.PORT system property must be specified");
}
- if (_key == null)
+ if (key == null)
{
- _key = "";
+ key = "";
System.err.println("STOP.KEY system property must be specified");
System.err.println("Using empty key");
}
- try (Socket s = new Socket(InetAddress.getByName("127.0.0.1"),_port))
+ try (Socket s = new Socket(InetAddress.getByName(host),port))
{
if (timeout > 0)
{
@@ -874,7 +875,7 @@ public class Main
try (OutputStream out = s.getOutputStream())
{
- out.write((_key + "\r\nstop\r\n").getBytes());
+ out.write((key + "\r\nstop\r\n").getBytes());
out.flush();
if (timeout > 0)
diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
index 0817b46738..eacb16b620 100644
--- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
+++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
@@ -108,6 +108,10 @@ Startup / Shutdown Command Line:
Properties:
+ STOP.HOST=[string]
+ The host to use to stop the running Jetty server (defaults to 127.0.0.1)
+ Required along with STOP.PORT if you want to use the --stop option above.
+
STOP.PORT=[number]
The port to use to stop the running Jetty server.
Required along with STOP.KEY if you want to use the --stop option above.

Back to the top