Sevas
Sevas

Reputation: 4273

Running parallel schedules in JBoss 4.0.5.GA

I am trying to define two schedulers in jboss-service.xml. One scheduler runs frequently and takes a short amount of time to execute. The other scheduler runs once every day, but takes a significant amount of time to execute. An excerpt of my jboss-service.xml follows:

<!-- Frequent, fast -->
<mbean code="org.jboss.varia.scheduler.Scheduler" 
       name=":service=FrequentSchedule,schedule=frequent">
    <attribute name="InitialStartDate">NOW</attribute>
    <attribute name="SchedulePeriod">5000</attribute>
    <!-- Other attributes... -->
</mbean>

<!-- Infrequent, slow -->
<mbean code="org.jboss.varia.scheduler.Scheduler"
       name=":service=InfrequentSchedule,schedule=infrequent">
    <attribute name="InitialStartDate">0</attribute>
    <attribute name="SchedulePeriod">86400000</attribute>
    <!-- Other attributes... -->
</mbean>

The result of this configuration is that the frequent scheduler executes at the expected frequency until it is time to execute the long-running scheduler. At that point the frequent schedule is no longer executed until the long-running schedule completes. From the Javadocs of org.jboss.varia.scheduler.Scheduler:

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=

I tried to follow this advice, but it did not work. If anyone has any experience in getting more than one scheduler to run in parallel on JBoss 4.0.5.GA, any help will be much appreciated.

Upvotes: 1

Views: 1466

Answers (1)

immobiluser
immobiluser

Reputation: 359

Solved, adding this attribute in mbean

<attribute name="TimerName">jboss:service=TimerNew</attribute>

As it explain in JBoss-Scheduler-Quartz, using another service Timer, permit differents mbean on different service timer. So each timer are independant (parallel).

Upvotes: 1

Related Questions