* Catch Linkage- and VirtualMachineErrors in scheduler loops in order to

keep on trucking in the face of OutOfMemoryErrors and the like.
* Sleep first, then do the work in scheduler loop.
This commit is contained in:
hns 2007-05-03 14:51:37 +00:00
parent 72db2bf08e
commit 657b86dee5

View file

@ -1452,25 +1452,12 @@ public final class Application implements Runnable {
// interval between session cleanups
long lastSessionCleanup = System.currentTimeMillis();
// logEvent ("Starting scheduler for "+name);
while (Thread.currentThread() == worker) {
// purge sessions
try {
lastSessionCleanup = cleanupSessions(lastSessionCleanup);
} catch (Exception x) {
logError("Error in session cleanup", x);
}
// execute cron jobs
try {
executeCronJobs();
} catch (Exception x) {
logError("Error in cron job execution", x);
}
// interval between scheduler runs
long sleepInterval = 60000;
try {
String sleepProp = props.getProperty("schedulerInterval");
if (sleepProp != null) {
@ -1489,6 +1476,28 @@ public final class Application implements Runnable {
worker = null;
break;
}
// purge sessions
try {
lastSessionCleanup = cleanupSessions(lastSessionCleanup);
} catch (Exception x) {
logError("Error in session cleanup: " + x, x);
} catch (LinkageError x) {
logError("Error in session cleanup: " + x, x);
}
// execute cron jobs
try {
executeCronJobs();
} catch (Exception x) {
logError("Error in cron job execution: " + x, x);
} catch (LinkageError x) {
logError("Error in cron job execution: " + x, x);
}
} catch (VirtualMachineError error) {
logError("Error in scheduler loop: " + error, error);
}
}
// when interrupted, shutdown running cron jobs