johnding1996 / HKUST-COMP3111H-Group

Group Project of COMP 3111H in Fall 2017 at HKUST
Apache License 2.0
0 stars 0 forks source link

Handle periodic and delay event in Controller #35

Closed thomaszhouan closed 7 years ago

thomaszhouan commented 7 years ago
gongaa commented 7 years ago

Spring @Scheduled only works for cron.fixedDelay and fixedRate do not work for callback because it will do the loop again and again. Bildschirmfoto 2017-10-29 um 8.22.48 PM.PDF It seems that ScheduledExecutorService is the best implementation way for delay a method I can find.

gongaa commented 7 years ago

Heroku server is using UTC time, but we can config it by 'heroku config:add TZ="Asia/Hong_Kong"'. Need to be careful when setting the cron expression.

thomaszhouan commented 7 years ago

Time zone can be set using zone field in @Scheduled annotation