ItsApiScheduler.java 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package com.its.op.scheduler;
  2. import com.its.op.config.JobConfig;
  3. import com.its.op.scheduler.job.*;
  4. import lombok.AllArgsConstructor;
  5. import lombok.extern.slf4j.Slf4j;
  6. import org.springframework.scheduling.annotation.Async;
  7. import org.springframework.scheduling.annotation.EnableScheduling;
  8. import org.springframework.scheduling.annotation.Scheduled;
  9. import org.springframework.stereotype.Component;
  10. import javax.annotation.PreDestroy;
  11. @Slf4j
  12. @AllArgsConstructor
  13. @EnableScheduling
  14. @Component
  15. public class ItsApiScheduler {
  16. private final JobConfig jobConfig;
  17. private final CctvPsetCtrlScnrJobThread cctvPsetScnrThread;
  18. private final FcltSttsJobThread fcltSttsJobThread;
  19. private final UnitSttsJobThread unitSttsJobThread;
  20. private final BaseDbmsJobThread baseDbmsJobThread;
  21. private final DbSvrSttsJobThread dbSvrSttsJobThread;
  22. @PreDestroy
  23. public void onShutDown() {
  24. }
  25. /**
  26. * CCTV Preset 제어 스케줄러
  27. */
  28. @Async
  29. @Scheduled(cron = "0 * * * * *") // 1분 주기 작업 실행
  30. public void jobCctvPsetScnr() {
  31. if (this.jobConfig.isCctvPreset()) {
  32. this.cctvPsetScnrThread.run();
  33. }
  34. }
  35. /**
  36. * 기초데이터 메모리 로딩
  37. */
  38. @Async
  39. @Scheduled(cron = "5 * * * * *") // 60초 주기 작업 실행
  40. public void pollingBaseDbms() {
  41. if (this.jobConfig.isBaseDbms()) {
  42. this.baseDbmsJobThread.run();
  43. }
  44. }
  45. /**
  46. * 프로세스 상태정보 조회 및 전송
  47. */
  48. @Async
  49. @Scheduled(cron = "20 * * * * *") // 60초 주기 작업 실행
  50. public void pollingUnitStts() {
  51. if (this.jobConfig.isUnitStts()) {
  52. this.unitSttsJobThread.run();
  53. }
  54. }
  55. /**
  56. * 시설물 상태정보 조회 및 전송
  57. */
  58. @Async
  59. @Scheduled(cron = "25 * * * * *") // 60초 주기 작업 실행
  60. public void pollingFcltStts() {
  61. if (this.jobConfig.isFcltStts()) {
  62. this.fcltSttsJobThread.run();
  63. }
  64. }
  65. /**
  66. * DB Server Stts Update
  67. */
  68. @Async
  69. //@Scheduled(cron = "40 0/1 * * * *") // 5분 주기 작업 실행
  70. @Scheduled(cron = "0/10 * * * * *") // 5분 주기 작업 실행
  71. public void jobDbSvrStts() {
  72. if (this.jobConfig.isDbSvrStts()) {
  73. this.dbSvrSttsJobThread.run();
  74. }
  75. }
  76. /*@Async
  77. @Scheduled(cron = "0/2 * * * * *") // 2초 주기 작업 실행
  78. public void checkKafkaServerAlive() {
  79. }*/
  80. }