Skip to content

jacopo-cavallarin/quarkus-quartz-bug-reproducer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quarkus-quartz-bug-reproducer

This project is a reproducer for a bug in the quarkus-quartz extension.

Description of the bug

The bug happens when scheduling asynchronous jobs programmatically while using the jdbc-cmt store for Quartz jobs.

The job details are stored in the qrtz_job_details when the job is first scheduled. After that, retrieving the stored job programmatically results in an exception like this:

...
Caused by: java.lang.ClassCastException: class io.test.ProgrammaticAsyncJob_ClientProxy cannot be cast to class java.util.function.Consumer (io.test.ProgrammaticAsyncJob_ClientProxy is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @463c632c; java.util.function.Consumer is in module java.base of loader 'bootstrap')
        at io.quarkus.quartz.runtime.QuartzSchedulerImpl$SerializedExecutionMetadata.task(QuartzSchedulerImpl.java:1305)
        at io.quarkus.quartz.runtime.QuartzSchedulerImpl.createJobDefinitionQuartzTrigger(QuartzSchedulerImpl.java:928)
        at io.quarkus.quartz.runtime.QuartzSchedulerImpl.<init>(QuartzSchedulerImpl.java:312)
        ... 29 more

The problem seems to be that quarkus is attempting to read the async job as a synchronous one (as it's attempting to cast it to a Consumer<ScheduledExecution> instead of Function<ScheduledExecution, Uni<Void>>).

Structure

This application schedules two asynchronous quartz jobs to be run every second. One job (DeclarativeAsyncJob) is scheduled declaratively with @Scheduled, the other (ProgrammaticAsyncJob) programmatically with QuartzScheduler at startup (ProgrammaticJobInitializer).

Both jobs just log a message on each execution.

Steps to reproduce the bug

  1. Launch the application with
    ./mvnw quarkus:dev
  2. Notice that both jobs are printing a log message every second.
  3. Restart the application by pressing s.
  4. The application fails to start due to the exception mentioned above.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages