Renaming process
Dieser Commit ist enthalten in:
Ursprung
28bb51be35
Commit
8c99597bdd
@ -39,7 +39,7 @@ public class Subserver implements Runnable {
|
|||||||
|
|
||||||
private final String serverName;
|
private final String serverName;
|
||||||
private final Runnable shutdownCallback;
|
private final Runnable shutdownCallback;
|
||||||
private final Process p;
|
private final Process process;
|
||||||
private final PrintWriter writer;
|
private final PrintWriter writer;
|
||||||
private final ServerInfo server;
|
private final ServerInfo server;
|
||||||
private final Servertype type;
|
private final Servertype type;
|
||||||
@ -62,7 +62,7 @@ public class Subserver implements Runnable {
|
|||||||
this.shutdownCallback = shutdownCallback;
|
this.shutdownCallback = shutdownCallback;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
this.p = processBuilder.start();
|
this.process = processBuilder.start();
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
throw new SecurityException("Server could not be started", e);
|
throw new SecurityException("Server could not be started", e);
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public class Subserver implements Runnable {
|
|||||||
InetSocketAddress address = new InetSocketAddress("127.0.0.1", port);
|
InetSocketAddress address = new InetSocketAddress("127.0.0.1", port);
|
||||||
this.server = ProxyServer.getInstance().constructServerInfo(
|
this.server = ProxyServer.getInstance().constructServerInfo(
|
||||||
serverName, address, "SteamWar.de - Subserver", false);
|
serverName, address, "SteamWar.de - Subserver", false);
|
||||||
this.writer = new PrintWriter(p.getOutputStream(), true);
|
this.writer = new PrintWriter(process.getOutputStream(), true);
|
||||||
|
|
||||||
ProxyServer.getInstance().getScheduler().runAsync(Persistent.getInstance(), this);
|
ProxyServer.getInstance().getScheduler().runAsync(Persistent.getInstance(), this);
|
||||||
}
|
}
|
||||||
@ -94,8 +94,8 @@ public class Subserver implements Runnable {
|
|||||||
public void stop(){
|
public void stop(){
|
||||||
writer.println("stop");
|
writer.println("stop");
|
||||||
try {
|
try {
|
||||||
if(!p.waitFor(1, TimeUnit.MINUTES))
|
if(!process.waitFor(1, TimeUnit.MINUTES))
|
||||||
p.destroy();
|
process.destroy();
|
||||||
}catch(InterruptedException e){
|
}catch(InterruptedException e){
|
||||||
logger.log(Level.SEVERE, "Subserver stop interrupted!", e);
|
logger.log(Level.SEVERE, "Subserver stop interrupted!", e);
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
@ -124,7 +124,7 @@ public class Subserver implements Runnable {
|
|||||||
ProxyServer.getInstance().getServers().put(serverName, server);
|
ProxyServer.getInstance().getServers().put(serverName, server);
|
||||||
serverList.add(this);
|
serverList.add(this);
|
||||||
|
|
||||||
try(BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()))){
|
try(BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))){
|
||||||
String line = "";
|
String line = "";
|
||||||
while (!started && (line = reader.readLine()) != null) {
|
while (!started && (line = reader.readLine()) != null) {
|
||||||
started = line.contains("ViaVersion detected server version");
|
started = line.contains("ViaVersion detected server version");
|
||||||
@ -144,7 +144,7 @@ public class Subserver implements Runnable {
|
|||||||
}
|
}
|
||||||
cachedPlayers.clear();
|
cachedPlayers.clear();
|
||||||
|
|
||||||
p.waitFor();
|
process.waitFor();
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
logger.log(Level.SEVERE, "Server " + serverName + " was interrupted!", e);
|
logger.log(Level.SEVERE, "Server " + serverName + " was interrupted!", e);
|
||||||
fatalError();
|
fatalError();
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren