例如,我有两个任务:
<mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler">
<attribute name="StartAtStartup">true</attribute>
<attribute name="SchedulableClass">Scheduler1</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="SchedulePeriod">60</attribute>
<attribute name="InitialRepetitions">-1</attribute>
<attribute name="FixedRate">false</attribute>
</mbean>
<mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler2">
<attribute name="StartAtStartup">true</attribute>
<attribute name="SchedulableClass">Scheduler2</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="SchedulePeriod">3600</attribute>
<attribute name="InitialRepetitions">-1</attribute>
<attribute name="FixedRate">false</attribute>
</mbean>
I.e. 首先安排每分钟,每小时二次。
问题在于,如果执行第二个任务需要5分钟,那么第一个任务在此时就没有执行,而是等待第二个任务完成。
是否有办法让他们同时工作? 或者,我应该移到Quartz或其它东西?