13
0

Add Initial setup
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-02-20 12:15:03 +01:00
Ursprung abb38a48ad
Commit 24524036a8
2 geänderte Dateien mit 23 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -48,4 +48,10 @@ public class Storage {
public static final Map<Integer, ServerInfo> teamServers = new HashMap<>(); // TeamID -> ServerInfo map
public static final Map<ProxiedPlayer, Map<UUID, PlayerListItem.Item>> directTabItems = new HashMap<>();
public static final Map<Subserver, String> serverToNodeMap = new HashMap<>();
public static final Map<String, List<Subserver>> nodeToServerMap = new HashMap<>();
public static final Map<Subserver, Long> timeOfServerEmpty = new HashMap<>();
}

Datei anzeigen

@ -140,6 +140,7 @@ public class Subserver implements Runnable {
if(!process.waitFor(1, TimeUnit.MINUTES))
process.destroyForcibly();
thread.join();
cleanup();
}catch(InterruptedException e){
logger.log(Level.SEVERE, "Subserver stop interrupted!", e);
Thread.currentThread().interrupt();
@ -152,12 +153,24 @@ public class Subserver implements Runnable {
process.destroy();
}
thread.join();
cleanup();
}catch(InterruptedException e){
logger.log(Level.SEVERE, "Subserver stop interrupted!", e);
Thread.currentThread().interrupt();
}
}
private void cleanup() {
String nodeName = Storage.serverToNodeMap.remove(this);
if (nodeName != null) {
Storage.nodeToServerMap.computeIfPresent(nodeName, (s, list) -> {
list.remove(this);
if (list.isEmpty()) return null;
return list;
});
}
}
static void shutdown(){
while (!serverList.isEmpty()) {
Subserver server = serverList.get(0);
@ -240,4 +253,8 @@ public class Subserver implements Runnable {
shutdownCallback.run();
}
}
public long getPID() {
return process.pid();
}
}