[jboss-jira] [JBoss JIRA] Commented: (JBAS-8382) ScheduleManager's skip repeats can be negative

Toshiya Kobayashi (JIRA) jira-events at lists.jboss.org
Fri Nov 5 05:20:01 EDT 2010


    [ https://jira.jboss.org/browse/JBAS-8382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561515#action_12561515 ] 

Toshiya Kobayashi commented on JBAS-8382:
-----------------------------------------

This test case causes ERROR on server side when undeploying the ScheduleInstance because mListener is null (There is no repetition so that the test can be done quickly). It would not happen in real use cases.

18:10:04,658 ERROR [org.jboss.varia.scheduler.ScheduleManager] Could not stop Schedule target=test:name=SchedulableMBeanExample hit[javax.management.Notification, java.util.Date, long, javax.management.ObjectName, java.lang.String]: javax.management.ListenerNotFoundException: Listener not found null for object name jboss:service=Timer
	at org.jboss.mx.notification.MBeanServerListenerRegistry.remove(MBeanServerListenerRegistry.java:155) [:6.0.0.Beta5]
	at org.jboss.mx.server.MBeanServerImpl.removeNotificationListener(MBeanServerImpl.java:846) [:6.0.0.Beta5]
	at javax.management.MBeanServerInvocationHandler.invokeBroadcasterMethod(MBeanServerInvocationHandler.java:369) [:1.6.0_21]
	at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:239) [:1.6.0_21]
	at $Proxy116.removeNotificationListener(Unknown Source)	at org.jboss.varia.scheduler.ScheduleManager$ScheduleInstance.stop(ScheduleManager.java:851) [:6.0.0-SNAPSHOT]
	at org.jboss.varia.scheduler.ScheduleManager.removeSchedule(ScheduleManager.java:358) [:6.0.0-SNAPSHOT]


> ScheduleManager's skip repeats can be negative
> ----------------------------------------------
>
>                 Key: JBAS-8382
>                 URL: https://jira.jboss.org/browse/JBAS-8382
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Scheduling/Timers
>    Affects Versions: JBossAS-4.2.3.GA, JBossAS-5.1.0.GA, 6.0.0.M4
>            Reporter: Toshiya Kobayashi
>            Assignee: Toshiya Kobayashi
>             Fix For: 6.0.0.CR1
>
>
> If you use org.jboss.varia.scheduler.ScheduleManager with short 'period' (say, '1' ms), result of skip repeats calculation can be negative and it causes wrong repetition.
> The cause is casting long to int.
>       public void start() throws JMException
>       {
>          Date lStartDate = null;
>          // Check if initial start date is in the past
>          if (mStartDate.getTime() < new Date().getTime() && mPeriod > 0)
>          {
>             // If then first check if a repetition is in the future
>             long lNow = new Date().getTime() + 100;
>             int lSkipRepeats = (int) ((lNow - mStartDate.getTime()) / mPeriod) + 1;
>             log.debug("Old start date: " + mStartDate + ", now: " + new Date(lNow) + ", Skip repeats: " + lSkipRepeats)
> BTW, org.jboss.varia.scheduler.Scheduler properly casts it to long.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list