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

Remove non needed optionals in sched config #45488

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
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 @@ -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
Loading