diff --git a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java index b51588818b611..c8d8f5e670134 100644 --- a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java +++ b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java @@ -43,8 +43,6 @@ import com.cronutils.model.definition.CronDefinitionBuilder; import com.cronutils.parser.CronParser; -import io.quarkus.arc.Arc; -import io.quarkus.arc.InstanceHandle; import io.quarkus.runtime.StartupEvent; import io.quarkus.scheduler.Scheduled; import io.quarkus.scheduler.Scheduled.ConcurrentExecution; @@ -79,7 +77,8 @@ org.quartz.Scheduler produceQuartzScheduler() { } public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Config config, - SchedulerRuntimeConfig schedulerRuntimeConfig, Event skippedExecutionEvent, Instance jobs) { + SchedulerRuntimeConfig schedulerRuntimeConfig, Event skippedExecutionEvent, Instance jobs, + Instance userTransation) { enabled = schedulerRuntimeConfig.enabled; if (!enabled) { LOGGER.info("Quartz scheduler is disabled by config property and will not be started"); @@ -92,10 +91,10 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Co Map invokers = new HashMap<>(); UserTransaction transaction = null; - try (InstanceHandle handle = Arc.container().instance(UserTransaction.class)) { + try { boolean manageTx = quartzSupport.getBuildTimeConfig().storeType.isNonManagedTxJobStore(); - if (manageTx && handle.isAvailable()) { - transaction = handle.get(); + if (manageTx && userTransation.isResolvable()) { + transaction = userTransation.get(); } Properties props = getSchedulerConfigurationProperties(quartzSupport);