Investigate possibility to use a lazy threadpool for Quartz backed scheduler
See original GitHub issueA recently merged PR https://github.com/quarkusio/quarkus/pull/4554 adds code which doesn’t start the Scheduler
if there’s no @Scheduled
annotations detected. A side-effect of this is that the Schduler
if injected and used programmatically to start timers, will no longer function.
The reason why the start()
of the scheduler has been skipped, when no @Scheduled
is present is to prevent Quartz from eagerly starting a threadpool with certain (configured) number of threads. Details here https://github.com/quarkusio/quarkus/issues/4243. Looking at the implementation of the default and the only functional thread pool that comes in Quartz (org.quartz.simpl.SimpleThreadPool
), it creates a fixed set of threads eagerly and doesn’t let users configure the pool to be lazily initialized.
This enhancement request is to investigate if it’s possible to use Quarkus internal thread pool as an implementation of org.quartz.spi.ThreadPool
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Just one more comment - the handler passed to the
Vertx.setTimer()
method is executed using the event loop thread and so the code should not block. If you need to perform some blocking/long-running operation use theVertx.executeBlocking()
method inside the handler:See https://vertx.io/docs/vertx-core/java/#blocking_code for more information.
That means that the Scheduler extension API only supports declarative approach via the
@Scheduled
annotation.Not really. You can use
@Scheduled(every="10s")
where the value is parsed withDuration#parse()
. The value is always rounded to full second.For programmatic approach you could try
Vertx.setTimer(long, Handler<Long>)
andVertx.setPeriodic(long, Handler<Long>)
methods for non-blocking stuff (see https://vertx.io/docs/vertx-core/java/#_executing_periodic_and_delayed_actions). We will probaly add support for an injectablejava.util.concurrent.ScheduledExecutorService
for blocking tasks.