3 Replies Latest reply on Jan 9, 2006 11:38 AM by dimitris

    HASingleton Schedulable

    dionmcm

      I've currently got a Scheduleable - ie a class that extends org.jboss.varia.scheduler.Schedulable and it is deployed in a SAR with the following sort of jboss-service.xml

      <?xml version="1.0" encoding="UTF-8"?>
      
      <server>
       <classpath codebase="lib" archives="scheduler-plugin.jar"/>
      
       <mbean code="org.jboss.varia.scheduler.Scheduler"
       name="mydomain:service=MySchedulabler">
      
       <attribute name="StartAtStartup">true</attribute>
      
       <attribute name="SchedulableClass">
       my.example.SchedulableClass
       </attribute>
      
       <attribute name="InitialStartDate">NOW</attribute>
       <attribute name="InitialRepetitions">-1</attribute>
       <attribute name="SchedulePeriod">60000</attribute>
       <attribute name="SchedulableArguments">
       password, password
       </attribute>
      
       <attribute name="SchedulableArgumentTypes">
       java.lang.String, java.lang.String
       </attribute>
      
       <attribute name="TimerName">mydomain:service=MyTimer</attribute>
      
       <depends>
       <mbean code="javax.management.timer.Timer"
       name="mydomain:service=MyTimer" />
       </depends>
       </mbean>
      </server>


      But now I want to deploy this so that it is a HASingleton - ie I only want this schedulable to be kicked off on one node in a cluster, not every node.

      What is the easiest way for me to convert from the configuration I have to a singleton?

      I've seen some documentation around (JBoss AS Clustering ed7) that demonstrates a singleton schedulable, but only by using a defined MBean as the target action of a org.jboss.varia.scheduler.SingleScheduleProvider MBean. Is the easiest way to go from what I have now to a singleton schedulable define my task (class that currently extends Schedulable) as an MBean and then use the org.jboss.varia.scheduler.SingleScheduleProvider?

      I'm just a bit confused about the right way to configure this...

      Thanks,
      Dion.