提交 48932ae2 authored 作者: Thomas Mueller's avatar Thomas Mueller

Server tool: when starting one service fails, the started services are now stopped.

上级 dd477e58
...@@ -206,6 +206,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler { ...@@ -206,6 +206,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
out.println("Shutting down TCP Server at " + tcpShutdownServer); out.println("Shutting down TCP Server at " + tcpShutdownServer);
shutdownTcpServer(tcpShutdownServer, tcpPassword, tcpShutdownForce, false); shutdownTcpServer(tcpShutdownServer, tcpPassword, tcpShutdownForce, false);
} }
try {
if (webStart) { if (webStart) {
web = createWebServer(args); web = createWebServer(args);
web.setShutdownHandler(this); web.setShutdownHandler(this);
...@@ -234,12 +235,17 @@ public class Server extends Tool implements Runnable, ShutdownHandler { ...@@ -234,12 +235,17 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
tcp = createTcpServer(args); tcp = createTcpServer(args);
tcp.start(); tcp.start();
out.println(tcp.getStatus()); out.println(tcp.getStatus());
tcp.setShutdownHandler(this);
} }
if (pgStart) { if (pgStart) {
pg = createPgServer(args); pg = createPgServer(args);
pg.start(); pg.start();
out.println(pg.getStatus()); out.println(pg.getStatus());
} }
} catch (SQLException e) {
stopAll();
throw e;
}
} }
/** /**
...@@ -324,7 +330,10 @@ public class Server extends Tool implements Runnable, ShutdownHandler { ...@@ -324,7 +330,10 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
* @return the server * @return the server
*/ */
public static Server createTcpServer(String... args) throws SQLException { public static Server createTcpServer(String... args) throws SQLException {
return new Server(new TcpServer(), args); TcpServer service = new TcpServer();
Server server = new Server(service, args);
service.setShutdownHandler(server);
return server;
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论