* 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:
parent
72db2bf08e
commit
657b86dee5
1 changed files with 39 additions and 30 deletions
|
@ -1452,25 +1452,12 @@ public final class Application implements Runnable {
|
||||||
// interval between session cleanups
|
// interval between session cleanups
|
||||||
long lastSessionCleanup = System.currentTimeMillis();
|
long lastSessionCleanup = System.currentTimeMillis();
|
||||||
|
|
||||||
// logEvent ("Starting scheduler for "+name);
|
|
||||||
|
|
||||||
while (Thread.currentThread() == worker) {
|
while (Thread.currentThread() == worker) {
|
||||||
|
|
||||||
// purge sessions
|
|
||||||
try {
|
try {
|
||||||
lastSessionCleanup = cleanupSessions(lastSessionCleanup);
|
// interval between scheduler runs
|
||||||
} catch (Exception x) {
|
|
||||||
logError("Error in session cleanup", x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// execute cron jobs
|
|
||||||
try {
|
|
||||||
executeCronJobs();
|
|
||||||
} catch (Exception x) {
|
|
||||||
logError("Error in cron job execution", x);
|
|
||||||
}
|
|
||||||
|
|
||||||
long sleepInterval = 60000;
|
long sleepInterval = 60000;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String sleepProp = props.getProperty("schedulerInterval");
|
String sleepProp = props.getProperty("schedulerInterval");
|
||||||
if (sleepProp != null) {
|
if (sleepProp != null) {
|
||||||
|
@ -1489,6 +1476,28 @@ public final class Application implements Runnable {
|
||||||
worker = null;
|
worker = null;
|
||||||
break;
|
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
|
// when interrupted, shutdown running cron jobs
|
||||||
|
|
Loading…
Add table
Reference in a new issue