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

@ -312,21 +312,28 @@ public class ServerMonitor
while (_processes.size() > 0)
{
for (Iterator<ProcessRunner> iterator = _processes.iterator(); iterator.hasNext();)
try
{
ProcessRunner pr = iterator.next();
try
for (Iterator<ProcessRunner> iterator = _processes.iterator(); iterator.hasNext();)
{
pr.join(100);
}
catch (InterruptedException e)
{
e.printStackTrace();
ProcessRunner pr = iterator.next();
try
{
pr.join(100);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
if (pr.isDone())
iterator.remove();
}
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++;