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
Currently, the Scheduler and Worker API allows for non-positive periods on periodically scheduling but the underlying ScheduledExecutorServices don't. The javadoc doesn't specify any restrictions on period unlike initialDelay or delay where a non-positive value is considered to be an "execute without delay".
In theory, the default periodic logic could handle the case by executing such periodic tasks without any delay but I'm not certain the behavior is actually desired.
throw IAE with non-positive periods with the related operators and require the Scheduler/Worker API to do the same
allow 0 period and introduce workarounds inside the Scheduler/Worker implementations.
I prefer option 1 as nobody seem to have encountered this specific issue before that would have rendered the code inoperable anyway due to a crash similar to the SO case.
The text was updated successfully, but these errors were encountered:
It looks like the Scheduler.Worker.schedulePeriodically javadoc does specify the behavior for non-positive values:
* Note to implementors: non-positive {@code initialTime} and {@code period} should be regarded as
* non-delayed scheduling of the first and any subsequent executions.
* @param period
* the time interval to wait each time in between executing the action; non-positive values
* indicate no delay between repeated schedules
So in the case of the linked stackoverflow question its NewThreadWorker not following the contract specified by the javadoc. In addition there is the question whether the contract for Scheduler.schedulePeriodicallyDirect should be the same as Schduler.Worker.schedulePeriodically
The question then becomes either changing the contract for option 1 or more extensive testing of existing schedulers for option 2.
Currently, the
Scheduler
andWorker
API allows for non-positive periods on periodically scheduling but the underlyingScheduledExecutorService
s don't. The javadoc doesn't specify any restrictions on period unlikeinitialDelay
ordelay
where a non-positive value is considered to be an "execute without delay".In theory, the default periodic logic could handle the case by executing such periodic tasks without any delay but I'm not certain the behavior is actually desired.
Related StackOverflow question: https://stackoverflow.com/questions/44555253/spring-boot-and-rxjava2-integration-nullpointerexception-actually-not
So the tw options I see are as follows:
I prefer option 1 as nobody seem to have encountered this specific issue before that would have rendered the code inoperable anyway due to a crash similar to the SO case.
The text was updated successfully, but these errors were encountered: