[
https://issues.jboss.org/browse/WFLY-972?page=com.atlassian.jira.plugin.s...
]
Tomasz Adamski edited comment on WFLY-972 at 8/21/14 9:48 AM:
--------------------------------------------------------------
Cannot reproduce error.
I'm using the following code:
{code:java}
@Resource
private TimerService timerService;
@Schedule(dayOfWeek="Sun", persistent=false)
private void sunday(Timer t) {
}
public String checkTimer() {
Timer timer=timerService.getTimers().iterator().next();
return "Next invocation for locale "+Locale.getDefault()+" is
"+timer.getNextTimeout().toString();
}
{code}
Results:
* without setting locale: Next invocation for locale pl_PL is Sun Aug 24 00:00:00 CEST
2014
* -Duser.language=en -Duser.country=US: Next invocation for locale en_US is Sun Aug 24
00:00:00 CEST 2014
* -Duser.language=it -Duser.country=IT: Next invocation for locale it_IT is Sun Aug 24
00:00:00 CEST 2014
* -Duser.language=es -Duser.country=PE: Next invocation for locale es_PE is Sun Aug 24
00:00:00 CEST 2014
was (Author: tomekadamski):
Cannot reproduce error.
I'm using the following code:
{code:java}
@Resource
private TimerService timerService;
@Schedule(dayOfWeek="Sun", persistent=false)
private void sunday(Timer t) {
}
public String checkTimer() {
Timer timer=timerService.getTimers().iterator().next();
return "Next invocation for locale "+Locale.getDefault()+" is
"+timer.getNextTimeout().toString();
}
{code}
Results:
* without settings locale: Next invocation for locale pl_PL is Sun Aug 24 00:00:00 CEST
2014
* -Duser.language=en -Duser.country=US: Next invocation for locale en_US is Sun Aug 24
00:00:00 CEST 2014
* -Duser.language=it -Duser.country=IT: Next invocation for locale it_IT is Sun Aug 24
00:00:00 CEST 2014
* -Duser.language=es -Duser.country=PE: Next invocation for locale es_PE is Sun Aug 24
00:00:00 CEST 2014
EJB calendar timer Sunday calculation problem in certain locales
----------------------------------------------------------------
Key: WFLY-972
URL:
https://issues.jboss.org/browse/WFLY-972
Project: WildFly
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: EJB
Environment: JDK 6 & 7
Reporter: Cheng Fang
Assignee: Tomasz Adamski
My ejb class contains this timeout method:
{code:java}
@Schedule(dayOfWeek="Sun", persistent=false)
private void sunday(Timer t) {
}
{code}
When calling this timer.getNextTimeout(), it returned the Sunday after next Sunday
(expecting next Sunday) when running on certain locales (it_IT, es_PE, etc). It works as
expected on other locales like en_US.
I added -Duser.language=it -Duser.country=IT to JAVA_OPTS when starting standalone server
to use that locale.
Seems to be a JDK bug. There could be some differences how dates are calculated in
different locales, but shouldn't be that big like skip one Sunday. Today is Wed.
One workaround is "to use locale.English when instantiating GregorianCalendar in the
following classes." I tried it on 7.2 with it_IT, and got the expected Sunday.
{noformat}
ejb3/src/main/java/org/jboss/as/ejb3/timerservice/schedule/CalendarBasedTimeout.java
ejb3/src/main/java/org/jboss/as/ejb3/timerservice/schedule/util/CalendarUtil.java
ejb3/src/main/java/org/jboss/as/ejb3/timerservice/task/CalendarTimerTask.java
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)