Advertisement
Xardas365

ScheduledTasks

Nov 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. @Component
  2. public class ScheduledTasks {
  3. private static final Logger log = LoggerFactory.getLogger(ScheduledTasks.class);
  4.  
  5. private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
  6. private static final String CRON_TIME_FOR_SCRAPPER_FROM_ANNOUNCEMENT_SERVICE = "0 15 10 15 * ?";
  7.  
  8. @Autowired
  9. private EventStartingNotificationWorker eventStartingNotificationWorker;
  10.  
  11. @Autowired
  12. private AnnoucementService annoucementService;
  13.  
  14. @Scheduled(fixedRate = 5000)
  15. public void reportCurrentTime() {
  16. //log.info("The time is now {}", dateFormat.format(new Date()));
  17. eventStartingNotificationWorker.check();
  18. }
  19. @Scheduled(cron = CRON_TIME_FOR_SCRAPPER_FROM_ANNOUNCEMENT_SERVICE)
  20. public void schedulerForCheckForNewChanges(){
  21. log.info("Running check new changes with a database: " + CRON_TIME_FOR_SCRAPPER_FROM_ANNOUNCEMENT_SERVICE);
  22. annoucementService.checkForNewChanges();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement