[
https://issues.jboss.org/browse/WFLY-2840?page=com.atlassian.jira.plugin....
]
Brad Maxwell edited comment on WFLY-2840 at 1/30/14 12:39 AM:
--------------------------------------------------------------
The issue appears to be in
org.jboss.as.ejb3.timerservice.task.CalendarTimerTask
It looks like calculateNextTimeout, Calendar cal = new GregorianCalendar(), should take in
the timezone specified in the ScheduleExpression, such as :
TimeZone tz = TimeZone.getTimeZone(((CalendarTimer)
timer).getCalendarTimeout().getScheduleExpression().getTimezone());
Calendar cal = new GregorianCalendar(tz);
Or actually, CalendarTimerTask is calling CalendarBasedTimeout.getNextTimeout which takes
in the calendar created from CalendarTimerTask, and it has access to the
scheduleExpression, so that is probably the better place to change it.
org.jboss.as.ejb3.timerservice.schedule.CalendarBasedTimeout.getNextTimeout
nextCal.setTimeZone(TimeZone.getTimeZone(scheduleExpression.getTimezone()));
Currently:
21:53:00,006 INFO [stdout] (EJB default - 1) ScheduleTest: nextTimeout:Wed Jan 29
22:00:00 CST 2014
With Change:
21:51:00,025 INFO [stdout] (EJB default - 1) ScheduleTest: nextTimeout:Wed Jan 29
21:52:00 CST 2014
21:52:00,002 INFO [stdout] (EJB default - 2) ScheduleTest: nextTimeout:Wed Jan 29
21:53:00 CST 2014
...
was (Author: bmaxwell):
The issue appears to be in
org.jboss.as.ejb3.timerservice.task.CalendarTimerTask
It looks like calculateNextTimeout, Calendar cal = new GregorianCalendar(), should take in
the timezone specified in the ScheduleExpression, such as :
TimeZone tz = TimeZone.getTimeZone(((CalendarTimer)
timer).getCalendarTimeout().getScheduleExpression().getTimezone());
Calendar cal = new GregorianCalendar(tz);
Currently:
21:53:00,006 INFO [stdout] (EJB default - 1) ScheduleTest: nextTimeout:Wed Jan 29
22:00:00 CST 2014
With Change:
21:51:00,025 INFO [stdout] (EJB default - 1) ScheduleTest: nextTimeout:Wed Jan 29
21:52:00 CST 2014
21:52:00,002 INFO [stdout] (EJB default - 2) ScheduleTest: nextTimeout:Wed Jan 29
21:53:00 CST 2014
...
@Schedule EJB Timer not using timezone when calcualting next timeout
--------------------------------------------------------------------
Key: WFLY-2840
URL:
https://issues.jboss.org/browse/WFLY-2840
Project: WildFly
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: EJB
Affects Versions: 8.0.0.CR1
Reporter: Brad Maxwell
Assignee: David Lloyd
With a system running in Central Timezone, if it uses the annotation below specifying the
timezone as Eastern timezone, with the hour set to the current hour.
The timer will fire once, and it will calculate the next timeout to be in the next hour
CST, where as it should take in consideration the timezone specified on @Schedule which is
Eastern. If it did, then the timer should continue to fire every minute.
{code}
@Schedule(persistent = false, timezone = "America/New_York", dayOfMonth =
"*", dayOfWeek = "*", month = "*", hour = "22",
minute = "*", second = "0", year = "*")
{code}
21:53:00,006 INFO [stdout] (EJB default - 1) ScheduleTest: nextTimeout:Wed Jan 29
22:00:00 CST 2014
{code}
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;
@Startup
@Singleton
public class ScheduleTest {
@Schedule(persistent = false, timezone = "America/New_York", dayOfMonth =
"*", dayOfWeek = "*", month = "*", hour = "22",
minute = "*", second = "0", year = "*")
public void helloWorld(Timer time) {
System.out.println("ScheduleTest: timer:" + time.getClass().getName() +
" " + time.getNextTimeout() + " " + time.getInfo());
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira