提交 99e81c67 编写于 作者: J Jesse Glick

Merge branch 'cron-fixed-start' of github.com:anafke/jenkins

......@@ -194,14 +194,22 @@ public abstract class Trigger<J extends Item> implements Describable<Trigger<?>>
public static class Cron extends PeriodicWork {
private final Calendar cal = new GregorianCalendar();
public Cron() {
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
}
public long getRecurrencePeriod() {
return MIN;
}
public long getInitialDelay() {
return MIN - (Calendar.getInstance().get(Calendar.SECOND) * 1000);
}
public void doRun() {
while(new Date().getTime()-cal.getTimeInMillis()>1000) {
while(new Date().getTime() >= cal.getTimeInMillis()) {
LOGGER.log(Level.FINE, "cron checking {0}", cal.getTime());
try {
checkTriggers(cal);
} catch (Throwable e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册