Added try catch in BungeeRotator and ServerMonitor so they don't crash out.

This commit is contained in:
Jonathan Williams 2015-02-14 00:47:03 -08:00
parent 6383cf7ce6
commit beac0b4828
2 changed files with 374 additions and 342 deletions

View File

@ -34,6 +34,8 @@ public class BungeeRotator
int maxRecordCount = 10;
while (true)
{
try
{
List<BungeeServer> bungeeServers = _repository.getBungeeServers();
HashSet<String> usServers = new HashSet<String>();
@ -179,5 +181,19 @@ public class BungeeRotator
e.printStackTrace();
}
}
catch (Exception ex)
{
System.out.println("Error doing something : " + ex.getMessage());
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
}
}

View File

@ -88,6 +88,8 @@ public class ServerMonitor
HashMap<String, Entry<String, Long>> serverTracker = new HashMap<String, Entry<String, Long>>();
while (true)
{
try
{
_totalPlayers = 0;
_serverStatuses = _repository.getServerStatuses();
@ -331,6 +333,20 @@ public class ServerMonitor
_count++;
}
catch (Exception ex)
{
log("Error doing something : " + ex.getMessage());
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
}
private static void killDeadServers()