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

Quartz - replace Arc.container() with Instance<UserTransaction> #13207

Merged
merged 1 commit into from
Nov 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -79,7 +77,8 @@ org.quartz.Scheduler produceQuartzScheduler() {
}

public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Config config,
SchedulerRuntimeConfig schedulerRuntimeConfig, Event<SkippedExecution> skippedExecutionEvent, Instance<Job> jobs) {
SchedulerRuntimeConfig schedulerRuntimeConfig, Event<SkippedExecution> skippedExecutionEvent, Instance<Job> jobs,
Instance<UserTransaction> userTransation) {
enabled = schedulerRuntimeConfig.enabled;
if (!enabled) {
LOGGER.info("Quartz scheduler is disabled by config property and will not be started");
Expand All @@ -92,10 +91,10 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Co
Map<String, ScheduledInvoker> invokers = new HashMap<>();
UserTransaction transaction = null;

try (InstanceHandle<UserTransaction> 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);

Expand Down