0 Replies Latest reply on Jul 30, 2008 4:40 PM by smitjel

    How do you run multiple schedules (mbeans)? What am I doing

    smitjel

      I need the ability to run multiple schedules (scheduled mbeans, both able to run at the same exact time) on Jboss 4.0.5/JDK5. I reviewed the Scheduler javadocs (http://docs.jboss.org/jbossas/javadoc/4.0.5/varia/org/jboss/varia/scheduler/Scheduler.html) and it specifically states:

      Scheduler Instance to allow clients to run this as a scheduling service for any Schedulable instances.
      ATTENTION: The scheduler instance only allows to run one schedule at a time. Therefore when you want to run two schedules create to instances with this MBean. Suggested Object Name for the MBean are:
      :service=Scheduler,schedule=
      This way you should not run into a name conflict.

      I'm almost positive I've done what is recommended to run multiple schedules. Here is what the jmx-console says (among other things) about my scheduled mbeans I've created in a deployed SAR:
      name=MQLoaderA
      name=MQLoaderB
      name=MQLoaderC
      schedule=MQLoaderA,service=Scheduler
      schedule=MQLoaderB,service=Scheduler
      schedule=MQLoaderC,service=Scheduler
      service=ScheduleManager
      service=Timer

      Here is what my jboss-service.xml looks like for these mbeans:
      <mbean code="com.titanium.business.scheduler.Loader" name=":name=MQLoaderA"></mbean>
      
      <mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler,schedule=MQLoaderA">
       <depends>jboss:service=ScheduleManager</depends>
       <depends>jboss.j2ee:service=EJB,jndiName=titanium/MQLoaderMap</depends>
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableMBean">:name=MQLoaderA</attribute>
       <attribute name="SchedulableMBeanMethod">doIt()</attribute>
       <attribute name="InitialStartDate">1/1/08 1:00 am</attribute>
       <attribute name="SchedulePeriod">3600000</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       <attribute name="FixedRate">true</attribute>
      </mbean>
      
      <mbean code="com.titanium.business.scheduler.Loader" name=":name=MQLoaderB"></mbean>
      
      <mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler,schedule=MQLoaderB">
       <depends>jboss:service=ScheduleManager</depends>
       <depends>jboss.j2ee:service=EJB,jndiName=titanium/MQLoaderMap</depends>
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableMBean">:name=MQLoaderB</attribute>
       <attribute name="SchedulableMBeanMethod">doIt()</attribute>
       <attribute name="InitialStartDate">1/1/08 1:00 am</attribute>
       <attribute name="SchedulePeriod">3600000</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       <attribute name="FixedRate">true</attribute>
      </mbean>
      
      <mbean code="com.titanium.business.scheduler.Loader" name=":name=MQLoaderC"></mbean>
      
      <mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=Scheduler,schedule=MQLoaderC">
       <depends>jboss:service=ScheduleManager</depends>
       <depends>jboss.j2ee:service=EJB,jndiName=titanium/MQLoaderMap</depends>
       <attribute name="StartAtStartup">true</attribute>
       <attribute name="SchedulableMBean">:name=MQLoaderC</attribute>
       <attribute name="SchedulableMBeanMethod">doIt()</attribute>
       <attribute name="InitialStartDate">1/1/08 1:00 am</attribute>
       <attribute name="SchedulePeriod">3600000</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       <attribute name="FixedRate">true</attribute>
      </mbean>

      These MBeans are configured to fire at the same exact time (on the hour) but they don't; they run one after the other. Did I not name the schedules correctly like the javadocs suggested? This worked perfectly on JBoss 3.2.6 so I'm a little confused. I appreciate any help with this. Thanks!