Skip to content

Commit

Permalink
fix(scheduler start error): change scheduler start method
Browse files Browse the repository at this point in the history
  • Loading branch information
love98ooo committed Nov 23, 2023
1 parent f63e5ac commit 6d919ca
Showing 1 changed file with 3 additions and 4 deletions.
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

0 comments on commit 6d919ca

Please sign in to comment.