7 Replies Latest reply on Nov 30, 2016 6:13 AM by alesj

    Scheduling in Jboss AS 7

    zenzei2k

      Hi mates! i'm in the process of migration from Jboss 4 to 7 and I have doubts about how to configure a scheduler. In Jboss 4 there were the org.jboss.varia.schduler package, and I can define a scheduler in jboss-service.xml like

       

        <mbean code="org.jboss.varia.scheduler.Scheduler" name=":madex=MySchduler">

          <attribute name="StartAtStartup">true</attribute>

          <attribute name="SchedulableClass">com.test.MyScheduler</attribute>

          <attribute name="SchedulableArguments">CustomName</attribute>

          <attribute name="SchedulableArgumentTypes">java.lang.String</attribute>

          <attribute name="InitialStartDate">0</attribute>

          <attribute name="SchedulePeriod">${scheduler.period}</attribute>

          <attribute name="InitialRepetitions">-1</attribute>

        </mbean>

       

      With the class com.test.MyScheduler implementing the org.jboss.varia.scheduler.Schedulable interface.

       

      Is there an easy way to do this en Jboss 7?

       

      Thanks in advance!

        • 1. Re: Scheduling in Jboss AS 7
          alesj

          "varia" is long gone.

          Perhaps try using EJB timers/schedulers or bundle Quartz with AS7.

          In the worst case you could try porting that varia code, making it a module, configuring mbeans, ...

          2 of 2 people found this helpful
          • 2. Re: Scheduling in Jboss AS 7
            zenzei2k

            Thanks Justin, I'll try to use Ejb timers then.

            Regards,

            • 3. Re: Scheduling in Jboss AS 7
              dabramov

              The old scheduler allowed for very simple management of the timers. In a few clicks in jmx-console and I could stop / start / change the period of the scheudle. From what I can tell none of this is possible without significant custom development on top of EJB timers. I'm really rather hoping I'm wrong here. How are the EJB timers managed?

               

              Thanks,

              -Dan

              • 4. Re: Scheduling in Jboss AS 7
                bmaxwell

                You could just make an @Singleton and have it bind itself into the MBean Server, the @Singleton can have the methods you want show up in jconsole, then the @Singleton can make calls to an @Stateless EJB that has @Timeout ejb timers.

                • 5. Re: Scheduling in Jboss AS 7
                  wdfink

                  If you need a fix scheduler you might use @Schedule.

                  A programatic way is to use the TimerService there are several methods to create scheduled, recurring or single action timers.

                   

                  You can use it with @Singleton or @Stateless beans dependent from your requirements.

                  • 6. Re: Scheduling in Jboss AS 7
                    piyushgoel996

                    Thanks @ales justin

                    Could you please tell me that how to do porting that varia code, making it a module, configuring mbeans, ... which you have mentioned.

                     

                    • 7. Re: Scheduling in Jboss AS 7
                      alesj

                      Varia was long gone in 2011, now it's 2016 ... :-)

                      So I suggest you use EJB timers -- as that'w why they were introduced.