geforkt von SteamWar/PersistentBungeeCore
Add Initial setup
Dieser Commit ist enthalten in:
Ursprung
abb38a48ad
Commit
24524036a8
@ -48,4 +48,10 @@ public class Storage {
|
|||||||
public static final Map<Integer, ServerInfo> teamServers = new HashMap<>(); // TeamID -> ServerInfo map
|
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<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<>();
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,7 @@ public class Subserver implements Runnable {
|
|||||||
if(!process.waitFor(1, TimeUnit.MINUTES))
|
if(!process.waitFor(1, TimeUnit.MINUTES))
|
||||||
process.destroyForcibly();
|
process.destroyForcibly();
|
||||||
thread.join();
|
thread.join();
|
||||||
|
cleanup();
|
||||||
}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();
|
||||||
@ -152,12 +153,24 @@ public class Subserver implements Runnable {
|
|||||||
process.destroy();
|
process.destroy();
|
||||||
}
|
}
|
||||||
thread.join();
|
thread.join();
|
||||||
|
cleanup();
|
||||||
}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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(){
|
static void shutdown(){
|
||||||
while (!serverList.isEmpty()) {
|
while (!serverList.isEmpty()) {
|
||||||
Subserver server = serverList.get(0);
|
Subserver server = serverList.get(0);
|
||||||
@ -240,4 +253,8 @@ public class Subserver implements Runnable {
|
|||||||
shutdownCallback.run();
|
shutdownCallback.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getPID() {
|
||||||
|
return process.pid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren