-
1. Re: jboss scheduler losing time
mrath Mar 18, 2008 12:15 AM (in response to mrath)Sorry, the configuration file looks like :
<mbean code="org.jboss.varia.scheduler.Scheduler" name="netspace.gateway.select:service=SelectGatewayConfigMBeanScheduler"> <attribute name="StartAtStartup">false</attribute> <attribute name="SchedulableMBean">netspace.gateway.select:service=SelectGatewayConfigMBean</attribute> <attribute name="SchedulableMBeanMethod">processNSEvent()</attribute> <attribute name="DateFormat">d/MM/yy HH:mm</attribute> <attribute name="InitialStartDate">24/01/07 11:00</attribute> <attribute name="SchedulePeriod">86400000</attribute> <attribute name="InitialRepetitions">-1</attribute> <depends>netspace.gateway.select:service=SelectGatewayConfigMBean</depends> </mbean>
-
2. Re: jboss scheduler losing time
genman Mar 21, 2008 5:10 PM (in response to mrath)What's going on is the time taken to run the task is added on to that period.
I suggest you use this instead:
http://wiki.jboss.org/wiki/Wiki.jsp?page=QuartzSchedulerIntegration
which is more reliable and has "cron"-like scheduling features and is more robust.
Or, you could come up with a bug+patch that fixes the drift. It'd be an easy feature to add. -
3. Re: jboss scheduler losing time
dimitris Mar 22, 2008 5:37 AM (in response to mrath)http://jira.jboss.com/jira/browse/JBAS-3282
<mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler"> ... <attribute name="FixedRate">true</attribute> <!-- HERE --> </mbean>
-
4. Re: jboss scheduler losing time
mrath Mar 24, 2008 11:23 PM (in response to mrath)Thanks very much for the quick replies.
<attribute name="FixedRate">true</attribute>
is really helpful to configure.
But we are using the jboss version 4.0.4 GA and it does not support this attribute 'FixedRate'. This is being supported from the version 4.0.5. -
5. Re: jboss scheduler losing time
dvinge Apr 3, 2008 4:32 AM (in response to mrath)Yes, we have had the same problem.
The issue is a jboss / jdk problem.
The underlying timer you are using are probably from the jdk and not the one from jboss.
The Jdk one, does not use fixedrate, so if your code takes 10 sec to run, then the scheduler will run 10 sec later. (I think we found out that this only applys to jdk6, but I'm not sure)
I have fixed this by extending the jdk timer, and override the addNotification (the one with 6 arguments), and then calling the super method (the one with 7 argument) allowing you to specify wheater to use fixedrate or not.
And then specifying this timer in your mbeans:
...
...
jboss:service=TimerMyTimer -
6. Re: jboss scheduler losing time
dvinge Apr 3, 2008 4:35 AM (in response to mrath)
...
...
jboss:service=TimerMyTimer -
7. Re: jboss scheduler losing time
dvinge Apr 3, 2008 4:36 AM (in response to mrath)
...
jboss:service=TimerMyTimer -
8. Re: jboss scheduler losing time
dvinge Apr 3, 2008 4:37 AM (in response to mrath)<mbean code="com.company.MyFixedRateTimer" name="jboss:service=TimerMyTimer"/>
<mbean code="org.jboss.varia.scheduler.Scheduler" name="com.company:service=MyScheduler">
...
<depends>jboss:service=TimerMyTimer</depends>
</mbean> -
9. Re: jboss scheduler losing time
peterj Apr 3, 2008 11:29 AM (in response to mrath)Use the Code button!