Description
Currently, the Scheduler
and Worker
API allows for non-positive periods on periodically scheduling but the underlying ScheduledExecutorService
s 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.
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:
- 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.