| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- package com.its.op.scheduler;
- import com.its.op.config.JobConfig;
- import com.its.op.config.ApplicationConfig;
- import com.its.op.scheduler.job.*;
- import lombok.AllArgsConstructor;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.scheduling.annotation.Async;
- import org.springframework.scheduling.annotation.EnableScheduling;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- import javax.annotation.PreDestroy;
- @Slf4j
- @AllArgsConstructor
- @EnableScheduling
- @Component
- public class ItsApiScheduler {
- private final ApplicationConfig applicationConfig;
- private final JobConfig jobConfig;
- private final FcltSttsJobThread fcltSttsJobThread;
- private final UnitSttsJobThread unitSttsJobThread;
- private final BaseDbmsJobThread baseDbmsJobThread;
- private final DbmsSttsJobThread dbmsSttsJobThread;
- @PreDestroy
- public void onShutDown() {
- }
- /**
- * CCTV Preset 제어 스케줄러
- */
- @Async
- @Scheduled(cron = "0 * * * * *") // 1분 주기 작업 실행
- public void jobCctvPsetScnr() {
- if (!this.applicationConfig.isStartSchedule()) {
- return;
- }
- }
- /**
- * 기초데이터 메모리 로딩
- */
- @Async
- @Scheduled(cron = "5 * * * * *") // 60초 주기 작업 실행
- public void pollingBaseDbms() {
- if (!this.applicationConfig.isStartSchedule()) {
- return;
- }
- if (this.jobConfig.isBaseDbms()) {
- this.baseDbmsJobThread.run();
- }
- }
- /**
- * 프로세스 상태정보 조회 및 전송
- */
- @Async
- @Scheduled(cron = "20 * * * * *") // 60초 주기 작업 실행
- public void pollingUnitStts() {
- if (!this.applicationConfig.isStartSchedule()) {
- return;
- }
- if (this.jobConfig.isUnitStts()) {
- this.unitSttsJobThread.run();
- }
- }
- /**
- * 시설물 상태정보 조회 및 전송
- */
- @Async
- @Scheduled(cron = "25 * * * * *") // 60초 주기 작업 실행
- public void pollingFcltStts() {
- if (!this.applicationConfig.isStartSchedule()) {
- return;
- }
- if (this.jobConfig.isFcltStts()) {
- this.fcltSttsJobThread.run();
- }
- }
- /**
- * DB Server Stts Update
- */
- @Async
- @Scheduled(cron = "40 0/10 * * * *") // 10분 주기 작업 실행
- //@Scheduled(cron = "40 * * * * *") // 10분 주기 작업 실행
- public void jobDbSvrStts() {
- if (!this.applicationConfig.isStartSchedule()) {
- return;
- }
- this.dbmsSttsJobThread.run();
- // if (this.jobConfig.isDbSvrStts()) {
- // this.dbSvrSttsJobThread.run();
- // }
- }
- /*@Async
- @Scheduled(cron = "0/2 * * * * *") // 2초 주기 작업 실행
- public void checkKafkaServerAlive() {
- }*/
- }
|