Added failsafe for ServerMonitor.

This commit is contained in:
Jonathan Williams 2015-10-12 22:26:24 -05:00
parent 1aecc9505c
commit a292fdb3c5

View File

@ -311,6 +311,8 @@ public class ServerMonitor
int processWaits = 0;
while (_processes.size() > 0)
{
try
{
for (Iterator<ProcessRunner> iterator = _processes.iterator(); iterator.hasNext();)
{
@ -328,6 +330,11 @@ public class ServerMonitor
if (pr.isDone())
iterator.remove();
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (_processes.size() > 0)
{
@ -342,7 +349,7 @@ public class ServerMonitor
}
}
if (processWaits >= 10)
if (processWaits >= 5)
{
log("Killing stale processes.");
@ -351,6 +358,8 @@ public class ServerMonitor
iterator.next().abort();
iterator.remove();
}
_processes.clear();
}
processWaits++;