Added a delay to killing 'dead' servers and a verification run after the initial test before killing.
This commit is contained in:
parent
fc45b80e2b
commit
836547f4f6
@ -39,6 +39,7 @@ public class ServerMonitor
|
|||||||
private static Collection<ServerGroup> _serverGroups = null;
|
private static Collection<ServerGroup> _serverGroups = null;
|
||||||
private static Map<String, ServerGroup> _serverGroupMap = null;
|
private static Map<String, ServerGroup> _serverGroupMap = null;
|
||||||
private static List<DedicatedServer> _dedicatedServers = null;
|
private static List<DedicatedServer> _dedicatedServers = null;
|
||||||
|
private static HashSet<String> _deadServers = new HashSet<String>();
|
||||||
|
|
||||||
private static SimpleDateFormat _dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
|
private static SimpleDateFormat _dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
|
||||||
private static Logger _logger = Logger.getLogger("ServerMonitor");
|
private static Logger _logger = Logger.getLogger("ServerMonitor");
|
||||||
@ -192,7 +193,7 @@ public class ServerMonitor
|
|||||||
|
|
||||||
if (onlineServers.contains(entry.getKey()))
|
if (onlineServers.contains(entry.getKey()))
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
else if (System.currentTimeMillis() - entry.getValue().getValue() > 30000)
|
else if (System.currentTimeMillis() - entry.getValue().getValue() > 35000)
|
||||||
{
|
{
|
||||||
String serverName = entry.getKey();
|
String serverName = entry.getKey();
|
||||||
String serverAddress = entry.getValue().getKey();
|
String serverAddress = entry.getValue().getKey();
|
||||||
@ -275,11 +276,23 @@ public class ServerMonitor
|
|||||||
|
|
||||||
private static void killDeadServers()
|
private static void killDeadServers()
|
||||||
{
|
{
|
||||||
|
HashSet<String> deadServers = new HashSet<String>();
|
||||||
|
deadServers.addAll(_deadServers);
|
||||||
|
|
||||||
|
_deadServers.clear();
|
||||||
for (MinecraftServer deadServer : _repository.getDeadServers())
|
for (MinecraftServer deadServer : _repository.getDeadServers())
|
||||||
{
|
{
|
||||||
killServer(deadServer.getName(), deadServer.getPublicAddress(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true);
|
if (deadServers.contains(deadServer.getName()))
|
||||||
|
{
|
||||||
handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup()));
|
killServer(deadServer.getName(), deadServer.getPublicAddress(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true);
|
||||||
|
|
||||||
|
handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_deadServers.add(deadServer.getName());
|
||||||
|
System.out.println("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user