Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting a custom threadpool class in quartz #45182

Open
danprueitt opened this issue Dec 18, 2024 · 1 comment · May be fixed by #45195
Open

Allow setting a custom threadpool class in quartz #45182

danprueitt opened this issue Dec 18, 2024 · 1 comment · May be fixed by #45195
Labels

Comments

@danprueitt
Copy link

Description

I would like to be able to tell quartz to use a VirtualThreadPool similar to this PR for my one off jobs.

Example of one off job:

public class TestJob implements Job {
  @Override
  public void execute(final JobExecutionContext context) throws JobExecutionException {
    System.out.println("Hello World!");
  }
}
@Inject final Scheduler scheduler

void test() throws SchedulerException {
        final JobDetail job1 =
        newJob(TestJob.class)
            .withIdentity("testjob", "group1")
            .usingJobData("someProp", "someValue")
            .build();

    final Trigger t = newTrigger().withIdentity("trigger1", "group1").startNow().build();

    scheduler.scheduleJob(job1, t);
}

Currently this is impossible to do with the quarkus scheduler because the QuartzSchedulerImpl.java only allows you to pass unsupported props that have not already been set by quartz itself.
See:

// As the very last step, pass all declared unsupported properties directly to Quartz
// Note that we are only passing in those that weren't already configured by user or Quarkus itself
for (Map.Entry<String, String> entry : quartzSupport.getRuntimeConfig().unsupportedProperties.entrySet()) {
props.putIfAbsent(entry.getKey(), entry.getValue());
}

The threadpool class is already set here:

props.put(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, "org.quartz.simpl.SimpleThreadPool");

So when I try to override it with application properties, it still users the built in SimpleThreadPool:

quarkus.quartz.unsupported-properties."org.quartz.threadPool.class"="com.picky.creators.common.scheduler.SimpleVirtualThreadPool"
org.quartz.threadPool.class="com.picky.creators.common.scheduler.SimpleVirtualThreadPool"

Implementation ideas

Expose the ability to change the threadpool impl.

@danprueitt danprueitt added the kind/enhancement New feature or request label Dec 18, 2024
Copy link

quarkus-bot bot commented Dec 18, 2024

/cc @machi1990 (quartz), @manovotn (quartz), @mkouba (quartz)

@manofthepeace manofthepeace linked a pull request Dec 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant