mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 21:42:27 +00:00
[fixed] if the timer is too busy, the old implementation can get behind the schedule. (issue #1512)
In 1.203. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@8278 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
7277f056e3
commit
a85572daae
1 file changed
+12
-9
@@ -26,6 +26,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Timer;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -135,17 +136,19 @@ public abstract class Trigger<J extends Item> implements Describable<Trigger<?>>
|
||||
private final Calendar cal = new GregorianCalendar();
|
||||
|
||||
public void doRun() {
|
||||
LOGGER.fine("cron checking "+cal.getTime().toLocaleString());
|
||||
while(new Date().getTime()-cal.getTimeInMillis()>1000) {
|
||||
LOGGER.fine("cron checking "+cal.getTime().toLocaleString());
|
||||
|
||||
try {
|
||||
checkTriggers(cal);
|
||||
} catch (Throwable e) {
|
||||
LOGGER.log(Level.WARNING,"Cron thread throw an exception",e);
|
||||
// bug in the code. Don't let the thread die.
|
||||
e.printStackTrace();
|
||||
try {
|
||||
checkTriggers(cal);
|
||||
} catch (Throwable e) {
|
||||
LOGGER.log(Level.WARNING,"Cron thread throw an exception",e);
|
||||
// bug in the code. Don't let the thread die.
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
cal.add(Calendar.MINUTE,1);
|
||||
}
|
||||
|
||||
cal.add(Calendar.MINUTE,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user