Concurrent scheduler tasks?
kresho Dec 4, 2006 5:51 AMI have two tasks that should be executed at different schedules, so I created to Schedulable classes and deployed two mbeans:
Task 1 (nightly):
<server> <mbean code="org.jboss.varia.scheduler.Scheduler" name="hr.chipoteka.erp.nightly-tasks:service=Scheduler"> <depends>jboss.j2ee:service=EJB,jndiName=ejb/NightlyTasksLocal</depends> <attribute name="StartAtStartup">true</attribute> <attribute name="SchedulableClass">hr.chipoteka.erp.server.NightlyTasksBean</attribute> <attribute name="DateFormat">yyyy-MM-dd HH:mm:ss</attribute> <attribute name="InitialStartDate">2006-10-30 21:30:00</attribute> <!-- attribute name="SchedulePeriod">60000</attribute --> <attribute name="SchedulePeriod">86400000</attribute> <attribute name="InitialRepetitions">-1</attribute> </mbean> </server>
And task 2 (every 10 seconds):
<server> <mbean code="org.jboss.varia.scheduler.Scheduler" name="hr.chipoteka.erp.synchronizer:service=Scheduler"> <depends>jboss.j2ee:service=EJB,jndiName=ejb/SynchronizerLocal</depends> <attribute name="StartAtStartup">true</attribute> <attribute name="SchedulableClass">hr.chipoteka.erp.server.SynchronizerBean</attribute> <attribute name="DateFormat">yyyy-MM-dd HH:mm:ss</attribute> <attribute name="InitialStartDate">2006-11-01 00:00:00</attribute> <attribute name="SchedulePeriod">10000</attribute> <attribute name="InitialRepetitions">-1</attribute> </mbean> </server>
jboss.app:
<?xml version="1.0"?> <jboss-app> <module> <har>hibernate-service.xml</har> </module> <module> <service>chipoteka-erp-nightly-tasks-scheduler-service.xml</service> </module> <module> <service>chipoteka-erp-synchronizer-scheduler-service.xml</service> </module> </jboss-app>
Sometimes execution times of these tasks overlap, but instead of being started concurrently, the scheduler starts them one after the other. How do I make them independent of one another and have them started at their schedules concurrently?