0

I have list of timezones; and for each timezone, I have to start schedule job. Following is the code

cronexpr = 0 30 8,12,15,17 * * ?
if(cronexpr != null){
  for(int i=0;i<tList.size();i++) {
  job = new JobDetailImpl("runSMSJob"+i,"SMSJobgrp"+i,SMSJob.class);
  trigger = new CronTriggerImpl("runMeJobTesting"+i, "group", "runSMSJob"+i, "SMSJobgrp"+i, cronexpr, tList.get(i));
  logger.info("TIMEZONE is            "+trigger.getTimeZone());
  schd.start();
  schd.scheduleJob(job, trigger);
}

Here tList is a list containing several timezones. On my local system its running properly but on server where the timezone is BST, even though the locale is India timezone, it's firing at the BST time.

Do any one have any idea on why its failing to take the specified timezone properly?

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
Preethi
  • 13
  • 5
  • Locale does not necessarily mean that the timezone is modified. What kind of OS is the "server" running? – ring bearer Mar 29 '12 at 17:10
  • Hi on the server the OS is Its windows 2003. And I am passing the locale to timezone constructor like this TimeZone tz = TimeZone.getTimeZone("Asia/Calcutta"); – Preethi Mar 30 '12 at 09:52
  • What does the line ` logger.info("TIMEZONE is "+trigger.getTimeZone());` print? – ring bearer Mar 31 '12 at 17:32
  • It prints the specific timezone itself. For eg: TIMEZONE is sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] – Preethi Apr 02 '12 at 07:21
  • Your code looks alright ( though you may use DSL based ). I even tested this on my machine (running EST) and it worked. Analyze to make sure that the job isn't triggering on expected timezone. In your `SMSJob` class's `execute()` add a debug line to print `(CronTrigger)context.getTrigger()).getTimeZone()` and see what timezone it prints. – ring bearer Apr 02 '12 at 16:49

0 Answers0