330265 start.jar --stop kills --exec subprocess
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2534 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
b063893cdf
commit
59f5bcce5b
|
@ -3,6 +3,7 @@ jetty-7.2.2-SNAPSHOT
|
||||||
+ 330208 Support new wording on servlet-mapping and filter-mapping merging from servlet3.0a
|
+ 330208 Support new wording on servlet-mapping and filter-mapping merging from servlet3.0a
|
||||||
+ 330188 Reject web-fragment.xml with same <name> as another already loaded one
|
+ 330188 Reject web-fragment.xml with same <name> as another already loaded one
|
||||||
+ 330229 Jetty tries to parse META-INF/*.tld when jsp-api is not on classpath, causing DTD entity resoluton to fail
|
+ 330229 Jetty tries to parse META-INF/*.tld when jsp-api is not on classpath, causing DTD entity resoluton to fail
|
||||||
|
+ 330265 start.jar --stop kills --exec subprocess
|
||||||
+ 330417 Atomic PUT in PutFilter
|
+ 330417 Atomic PUT in PutFilter
|
||||||
+ 330419 Reloading webapp duplicates StandardDescriptorProcessor
|
+ 330419 Reloading webapp duplicates StandardDescriptorProcessor
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,10 @@ public class Main
|
||||||
public void start(List<String> xmls) throws FileNotFoundException, IOException, InterruptedException
|
public void start(List<String> xmls) throws FileNotFoundException, IOException, InterruptedException
|
||||||
{
|
{
|
||||||
// Setup Start / Stop Monitoring
|
// Setup Start / Stop Monitoring
|
||||||
startMonitor();
|
int port = Integer.parseInt(_config.getProperty("STOP.PORT",System.getProperty("STOP.PORT","-1")));
|
||||||
|
String key = _config.getProperty("STOP.KEY",System.getProperty("STOP.KEY",null));
|
||||||
|
Monitor monitor=new Monitor(port,key);
|
||||||
|
|
||||||
|
|
||||||
// Load potential Config (start.config)
|
// Load potential Config (start.config)
|
||||||
List<String> configuredXmls = loadConfig(xmls);
|
List<String> configuredXmls = loadConfig(xmls);
|
||||||
|
@ -570,7 +573,7 @@ public class Main
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show Command Line to execute Jetty
|
// execute Jetty in another JVM
|
||||||
if (_exec)
|
if (_exec)
|
||||||
{
|
{
|
||||||
String cmd = buildCommandLine(classpath,configuredXmls);
|
String cmd = buildCommandLine(classpath,configuredXmls);
|
||||||
|
@ -578,6 +581,7 @@ public class Main
|
||||||
copyInThread(process.getErrorStream(),System.err);
|
copyInThread(process.getErrorStream(),System.err);
|
||||||
copyInThread(process.getInputStream(),System.out);
|
copyInThread(process.getInputStream(),System.out);
|
||||||
copyInThread(System.in,process.getOutputStream());
|
copyInThread(System.in,process.getOutputStream());
|
||||||
|
monitor.setProcess(process);
|
||||||
process.waitFor();
|
process.waitFor();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -641,7 +645,7 @@ public class Main
|
||||||
}
|
}
|
||||||
catch(IOException e)
|
catch(IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,13 +1058,6 @@ public class Main
|
||||||
return cfgstream;
|
return cfgstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startMonitor()
|
|
||||||
{
|
|
||||||
int port = Integer.parseInt(_config.getProperty("STOP.PORT",System.getProperty("STOP.PORT","-1")));
|
|
||||||
String key = _config.getProperty("STOP.KEY",System.getProperty("STOP.KEY",null));
|
|
||||||
|
|
||||||
Monitor.monitor(port,key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop a running jetty instance.
|
* Stop a running jetty instance.
|
||||||
|
|
|
@ -32,33 +32,31 @@ import java.net.Socket;
|
||||||
*/
|
*/
|
||||||
public class Monitor extends Thread
|
public class Monitor extends Thread
|
||||||
{
|
{
|
||||||
private int _port;
|
private Process _process;
|
||||||
private String _key;
|
private final int _port;
|
||||||
|
private final String _key;
|
||||||
|
|
||||||
ServerSocket _socket;
|
ServerSocket _socket;
|
||||||
|
|
||||||
Monitor(int port,String key)
|
Monitor(int port,String key)
|
||||||
{
|
{
|
||||||
_port=port;
|
|
||||||
_key=key;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(_port<0)
|
if(port<0)
|
||||||
return;
|
return;
|
||||||
setDaemon(true);
|
setDaemon(true);
|
||||||
setName("StopMonitor");
|
setName("StopMonitor");
|
||||||
_socket=new ServerSocket(_port,1,InetAddress.getByName("127.0.0.1"));
|
_socket=new ServerSocket(port,1,InetAddress.getByName("127.0.0.1"));
|
||||||
if (_port==0)
|
if (port==0)
|
||||||
{
|
{
|
||||||
_port=_socket.getLocalPort();
|
port=_socket.getLocalPort();
|
||||||
System.out.println(_port);
|
System.out.println(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_key==null)
|
if (key==null)
|
||||||
{
|
{
|
||||||
_key=Long.toString((long)(Long.MAX_VALUE*Math.random()+this.hashCode()+System.currentTimeMillis()),36);
|
key=Long.toString((long)(Long.MAX_VALUE*Math.random()+this.hashCode()+System.currentTimeMillis()),36);
|
||||||
System.out.println("STOP.KEY="+_key);
|
System.out.println("STOP.KEY="+key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
@ -66,12 +64,28 @@ public class Monitor extends Thread
|
||||||
Config.debug(e);
|
Config.debug(e);
|
||||||
System.err.println(e.toString());
|
System.err.println(e.toString());
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_port=port;
|
||||||
|
_key=key;
|
||||||
|
}
|
||||||
|
|
||||||
if (_socket!=null)
|
if (_socket!=null)
|
||||||
this.start();
|
this.start();
|
||||||
else
|
else
|
||||||
System.err.println("WARN: Not listening on monitor port: "+_port);
|
System.err.println("WARN: Not listening on monitor port: "+_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Process getProcess()
|
||||||
|
{
|
||||||
|
return _process;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcess(Process process)
|
||||||
|
{
|
||||||
|
_process = process;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
@ -93,6 +107,8 @@ public class Monitor extends Thread
|
||||||
{
|
{
|
||||||
try {socket.close();}catch(Exception e){e.printStackTrace();}
|
try {socket.close();}catch(Exception e){e.printStackTrace();}
|
||||||
try {_socket.close();}catch(Exception e){e.printStackTrace();}
|
try {_socket.close();}catch(Exception e){e.printStackTrace();}
|
||||||
|
if (_process!=null)
|
||||||
|
_process.destroy();
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
else if ("status".equals(cmd))
|
else if ("status".equals(cmd))
|
||||||
|
@ -116,13 +132,5 @@ public class Monitor extends Thread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Start a Monitor.
|
|
||||||
* This static method starts a monitor that listens for admin requests.
|
|
||||||
*/
|
|
||||||
public static void monitor(int port,String key)
|
|
||||||
{
|
|
||||||
new Monitor(port,key);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue