Closed carbotaniuman closed 5 years ago
Hum I am not sure I am following you. An Instant represent a single point in time. Do you want to run a job only once in the future?
If so you can create your Schedule
with: Schedules.executeOnce(Schedules.executeAt("05:30"))
And if you really want to pass an instant as a parameter you can do something like that: Schedules.executeOnce(new FixedDelaySchedule(Duration.between(Instant.now(), yourInstant)))
@amanteaux That's exactly what I mean. Does the second line of code have any pitfalls or gotchas?
@carbotaniuman no I do not see any pitfalls or gotchas. Also do not hesitate to directly create your own Schedule
. In your case you can do something like this: Schedules.executeOnce((c, e, l) -> yourInstant.getEpochSecond() * 1000);
. You can have a look at the Schedule
interface for details: https://github.com/Coreoz/Wisp/blob/master/src/main/java/com/coreoz/wisp/schedule/Schedule.java
I have an Instant class and I want to run a job based on this. Is this possible?