Skip to content

Commit

Permalink
Merge pull request #16711 from mkouba/quartz-remove-deprecated-config
Browse files Browse the repository at this point in the history
Quartz - remove the deprecated quarkus.quartz.force-start property
  • Loading branch information
machi1990 authored Apr 22, 2021
2 parents 56fbbdb + d672f91 commit eb46690
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 96 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class InjectJobTest {
static final QuarkusUnitTest test = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(Starter.class, Service.class, CountDownLatchProducer.class)
.addAsResource(new StringAsset("quarkus.quartz.force-start=true"),
.addAsResource(new StringAsset("quarkus.quartz.start-mode=forced"),
"application.properties"));

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.quarkus.quartz.runtime;

import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
Expand All @@ -27,17 +25,6 @@ public class QuartzRuntimeConfig {
@ConfigItem(defaultValue = "5")
public int threadPriority;

/**
* By default, the scheduler is not started unless a {@link io.quarkus.scheduler.Scheduled} business method is found.
* If set to true the scheduler will be started even if no scheduled business methods are found. This is necessary for
* "pure" programmatic scheduling.
*
* @deprecated use quarkus.quartz.start-mode=forced instead.
*/
@Deprecated
@ConfigItem
public Optional<Boolean> forceStart;

/**
* Scheduler can be started in different modes: normal, forced or halted.
* By default, the scheduler is not started unless a {@link io.quarkus.scheduler.Scheduled} business method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Sc
Event<SkippedExecution> skippedExecutionEvent, Instance<Job> jobs, Instance<UserTransaction> userTransaction) {
enabled = schedulerRuntimeConfig.enabled;
final QuartzRuntimeConfig runtimeConfig = quartzSupport.getRuntimeConfig();
warnDeprecated(runtimeConfig);

boolean forceStart;
if (runtimeConfig.startMode != QuartzStartMode.NORMAL) {
startHalted = (runtimeConfig.startMode == QuartzStartMode.HALTED);
forceStart = startHalted || (runtimeConfig.startMode == QuartzStartMode.FORCED);
} else {
startHalted = false;
forceStart = runtimeConfig.forceStart.orElse(false);
forceStart = false;
}

if (!enabled) {
Expand Down Expand Up @@ -206,18 +205,6 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Sc
}
}

/**
* Warn if there's any deprecated configuration
*
* @param runtimeConfig {@link QuartzRuntimeConfig} quartz scheduler configurations
*/
private static void warnDeprecated(QuartzRuntimeConfig runtimeConfig) {
if (runtimeConfig.forceStart.isPresent()) {
LOGGER.warn("`quarkus.quartz.force-start` is deprecated and will be removed in a future version - it is "
+ "recommended to switch to `quarkus.quartz.start-mode`");
}
}

@Produces
@Singleton
org.quartz.Scheduler produceQuartzScheduler() {
Expand Down

0 comments on commit eb46690

Please sign in to comment.