You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is to discuss the opportunity to share the code suggested in jmrozanec/cron-utils#491 within this module.
The pull requests has been closed because the functionality is more related to this extension module.
@jmrozanec : I checked the code in detail and found the following really important difference in the design of both solutions.
Your approach: Jobs a managed by additional polling thead(s) that check the trigger (usually by calling ExecutionTime.forCron(cron).nextExecution(ZonedDateTime.now()))
Our approach: Use ScheduledExecutorService.schedule() by calculating a "delay":
...
private ZonedDateTime nextExecution;
...
/**
* Plans the next execution time to run this job again.
*
* @param timeStamp the reference time stamp
*/
private void scheduleNext(final ZonedDateTime timeStamp) {
final Optional<ZonedDateTime> next = executionTime.nextExecution(timeStamp);
if (next.isPresent()) {
nextExecution = next.get();
final long delay = ChronoUnit.MILLIS.between(timeStamp, nextExecution);
scheduledFuture = executorService.schedule(this, delay, TimeUnit.MILLISECONDS);
} else {
// job maybe defined to run only once
scheduledFuture = null;
}
}
Advantage:
It's more lightweight and simple in general
No extra polling threads needed
Disadvantage:
No concept for more general Execution trigger
Scheduling of jobs other than calculated by Cron expressions maybe out-of-scope
So my question:
Is scheduling of non-Cron based jobs really a requirement?
If yes I would think our approach does not fit or can only be provided in addition to the current one.
If no I would suggest to re-code the scheduling using "our" approach.
Please let me know how we should go on!
And please be aware: No rush! This task will be done by me in my "private time" anyway ;-).
The text was updated successfully, but these errors were encountered:
@norbertroamsys we appreciate the work done so far! Thanks! 😄 We will have a look at the code, think about scenarios we are willing to address, and come back with an answer! 😄 🚀
This issue is to discuss the opportunity to share the code suggested in jmrozanec/cron-utils#491 within this module.
The pull requests has been closed because the functionality is more related to this extension module.
@jmrozanec : I checked the code in detail and found the following really important difference in the design of both solutions.
Your approach: Jobs a managed by additional polling thead(s) that check the trigger (usually by calling
ExecutionTime.forCron(cron).nextExecution(ZonedDateTime.now())
)Our approach: Use
ScheduledExecutorService.schedule()
by calculating a "delay":Advantage:
Disadvantage:
Cron
expressions maybe out-of-scopeSo my question:
Is scheduling of non-
Cron
based jobs really a requirement?If yes I would think our approach does not fit or can only be provided in addition to the current one.
If no I would suggest to re-code the scheduling using "our" approach.
Please let me know how we should go on!
And please be aware: No rush! This task will be done by me in my "private time" anyway ;-).
The text was updated successfully, but these errors were encountered: