Skip to content

Commit

Permalink
Remove non needed optionals in sched config
Browse files Browse the repository at this point in the history
  • Loading branch information
manofthepeace committed Jan 9, 2025
1 parent 985ecf5 commit 9756e1f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ List<ReflectiveClassBuildItem> reflectiveClasses(QuartzBuildTimeConfig config,
QuartzJDBCDriverDialectBuildItem driverDialect) {
List<ReflectiveClassBuildItem> reflectiveClasses = new ArrayList<>();

if (config.serializeJobData().orElse(false)) {
if (config.serializeJobData()) {
reflectiveClasses.add(ReflectiveClassBuildItem.builder(
String.class,
JobDataMap.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public interface QuartzBuildTimeConfig {
* This is equivalent of setting `org.quartz.jobStore.useProperties` to `true`.
*/
@WithDefault("false")
Optional<Boolean> serializeJobData();
boolean serializeJobData();

/**
* Instance ID generators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public QuartzSchedulerImpl(SchedulerContext context, QuartzSupport quartzSupport
this.schedulerConfig = schedulerConfig;
this.storeType = quartzSupport.getBuildTimeConfig().storeType();

StartMode startMode = schedulerRuntimeConfig.startMode().orElse(StartMode.NORMAL);
StartMode startMode = schedulerRuntimeConfig.startMode();

boolean forceStart;
if (startMode != StartMode.NORMAL) {
Expand Down Expand Up @@ -594,7 +594,7 @@ private Properties getSchedulerConfigurationProperties(QuartzSupport quartzSuppo
if (buildTimeConfig.storeType().isDbStore()) {
String dataSource = buildTimeConfig.dataSourceName().orElse("QUARKUS_QUARTZ_DEFAULT_DATASOURCE");
QuarkusQuartzConnectionPoolProvider.setDataSourceName(dataSource);
boolean serializeJobData = buildTimeConfig.serializeJobData().orElse(false);
boolean serializeJobData = buildTimeConfig.serializeJobData();
props.put(StdSchedulerFactory.PROP_JOB_STORE_USE_PROP, serializeJobData ? "false" : "true");
props.put(StdSchedulerFactory.PROP_JOB_STORE_PREFIX + ".tablePrefix", buildTimeConfig.tablePrefix());
props.put(StdSchedulerFactory.PROP_JOB_STORE_PREFIX + ".dataSource", dataSource);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.quarkus.scheduler.runtime;

import java.time.Duration;
import java.util.Optional;

import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
Expand Down Expand Up @@ -29,7 +28,8 @@ public interface SchedulerRuntimeConfig {
* Scheduler can be started in different modes. By default, the scheduler is not started unless a
* {@link io.quarkus.scheduler.Scheduled} business method is found.
*/
Optional<StartMode> startMode();
@WithDefault("normal")
StartMode startMode();

enum StartMode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public SimpleScheduler(SchedulerContext context, SchedulerRuntimeConfig schedule
return;
}

StartMode startMode = schedulerRuntimeConfig.startMode().orElse(StartMode.NORMAL);
StartMode startMode = schedulerRuntimeConfig.startMode();
if (startMode == StartMode.NORMAL && context.getScheduledMethods(Scheduled.SIMPLE).isEmpty()
&& !context.forceSchedulerStart()) {
this.scheduledExecutor = null;
Expand Down

0 comments on commit 9756e1f

Please sign in to comment.