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

fix(scheduler start error): change scheduler start method #76

Merged
merged 1 commit into from
Nov 23, 2023
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
7 changes: 3 additions & 4 deletions src/main/java/sast/evento/config/SchedulerConfig.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package sast.evento.config;

import lombok.extern.slf4j.Slf4j;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;
import sast.evento.common.enums.ErrorEnum;
import sast.evento.exception.LocalRunTimeException;
import sast.evento.utils.SchedulerUtil;

/**
* @Author: Love98
Expand All @@ -23,7 +20,9 @@ public class SchedulerConfig implements ApplicationListener<ContextRefreshedEven
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
try {
SchedulerUtil.startScheduler();
log.info("Start Scheduler");
SchedulerFactory schedulerFactoryBean = new StdSchedulerFactory();
schedulerFactoryBean.getScheduler().start();
} catch (SchedulerException e) {
throw new LocalRunTimeException(ErrorEnum.SCHEDULER_ERROR,"error start");
}
Expand Down