1
0

Terminating server if no shutdown after 60 seconds

Dieser Commit ist enthalten in:
Lixfel 2019-09-01 16:18:16 +02:00
Ursprung 686ff8f5fb
Commit b3e37c2d62

Datei anzeigen

@ -12,6 +12,7 @@ import java.net.InetSocketAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -27,6 +28,12 @@ public class Subserver implements Runnable {
} }
return null; return null;
} }
public static Subserver getSubserver(ServerInfo server){
for(Subserver s : serverList)
if(s.server == server)
return s;
return null;
}
public static List<Subserver> getServerList(){ public static List<Subserver> getServerList(){
return serverList; return serverList;
} }
@ -81,7 +88,8 @@ public class Subserver implements Runnable {
public void stop(){ public void stop(){
writer.println("stop"); writer.println("stop");
try { try {
p.waitFor(); if(!p.waitFor(1, TimeUnit.MINUTES))
p.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();