Use TriggerContext's Clock instead of new Date()
Closes gh-27546
This commit is contained in:
parent
715f300fa1
commit
e4934a90eb
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -105,11 +105,11 @@ public class CronTrigger implements Trigger {
|
|||
}
|
||||
}
|
||||
else {
|
||||
date = new Date();
|
||||
date = new Date(triggerContext.getClock().millis());
|
||||
}
|
||||
ZonedDateTime dateTime = ZonedDateTime.ofInstant(date.toInstant(), this.zoneId);
|
||||
ZonedDateTime next = this.expression.next(dateTime);
|
||||
return next != null ? Date.from(next.toInstant()) : null;
|
||||
return (next != null ? Date.from(next.toInstant()) : null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue