java - Amazon EC2 - Quartz and Job not running at correct time -
i have java app deployed on amazon ec2 server. use quartz scheduling various jobs.
i tried scheduling job run @ 9am - noticed didnt execute until 10am tried execute job @ 9am gmt-5 -should of executed @ 2pm gmt executed @ 3pm gmt
on further analysis noticed time on amazon server set in utc , hour behind gmt currently
i wondering - part of setup not correct since jobs not executing @ correct time?
do need specify when setting cron trigger? setting cron in quartz follows using cronschedulebuilder
cronexpression cronexpression = new cronexpression(cronvalue); timezone timezone = timezone.gettimezone("etc/gmt-5"); cronexpression.settimezone(timezone); trigger trigger = triggerbuilder.newtrigger().withidentity(triggername).startnow() .withschedule(cronschedulebuilder.cronschedule(cronexpression)).build(); jobdetail job = jobbuilder.newjob(mycloudtasksservertaskexecutor.class).withidentity(taskid.tostring()) .storedurably(true).build();
any appreciated
as wrote ec2 server running utc. gmt changed @ last sunday of march standard time daylight saving time.
i suggest time jobs in utc. start time of job different in summer , winter. have decide if ok you.
else have create 2 timers, 1 running march october , other october march differ in 1 hour.
it logical ec2 instances run utc because shift across time zones easier achieve.
Comments
Post a Comment