7 Replies Latest reply on Oct 30, 2003 12:55 PM by brianko

    MBean and Scheduling

    johnurban

      I need to have a java class startup when my web app gets deployed. So I have created an MBean that starts perfectly.

      I need to call a job database every 10 to 15 seconds in this MBean, checking for new jobs. Once a I get a job from the DB and need to kick off a thread to do some work.

      I foolishly coded the main loop in the startService() method, so once JBoss got to my MBean, the world stopped and nothing else got deployed.

      How do I accomplish this in an MBean or I am traveling the wrong road?

        • 1. Re: MBean and Scheduling
          jachildress

          Hey John,

          have you checked out Quartz?

          http://www.part.net/quartz.html

          We are using it for job scheduling with JBoss 3.2.2 and it works great. They even have an MBean that wraps the Scheduler.

          Let me know if you have any questions if you decide that Quartz might work for you.

          John


          thanks for the matlab help too ;-)

          • 2. Re: MBean and Scheduling
            ivelin.ivanov

            JBoss 3.2.1 and later include a sophisticated Scheduler service. In 3.2.2 it is even clustered.
            look for schedule-manager-service.xml under the deploy directory.

            • 3. Re: MBean and Scheduling
              mcvt

              Where can you find information about this scheduler, I can use the test, but I cannot find anywhere how you create the "listener" that is called from the scheduler.

              Thanks for any reply.

              • 4. Re: MBean and Scheduling
                ivelin.ivanov

                The JBoss Administration book talks about the Scheduler.

                A recent article can be used as a less detailed source of information:
                http://www.onjava.com/pub/a/onjava/2003/08/20/jboss_clustering.html

                Ivelin

                • 5. Re: MBean and Scheduling
                  ebasley

                  Hy,

                  I'm using Quartz thanks to your advice, it can be deployed nice has a MBean, but I can't find a way to create triggers and job ? (the remoteClient example doen't work). Can you explain how you are setting jobs/triggers ?

                  Regards.

                  Eric

                  • 6. Re: MBean and Scheduling
                    normal

                    how to deploy the Quartz as a MBean?
                    chould u give me an example?
                    thx in advance!

                    • 7. Re: MBean and Scheduling

                       

                      "brianko" wrote:
                      I did it in very different way. I created a start up class that register my timer Mbean and listener. It is reading my db and start all configured schedules. Also it registers the RMIAdapter to enable JMX management from my application.

                      What the listener does is to send a JMS message to predefined queue when it gets the notification from timer MBean. The subscribing MDB that does the job will be fired whenever it receive a message.

                      My plan work fine except that I got IllegalAccessError when I tried to manipulate the Mbean from my application. My plan was to update the DB and restart the MBean whenever the mbean configuration was changed through UI. It worked fine with Weblogic 7.0 but I am having a problem with Jboss 3.0.7.

                      As long as I do not try to access those Mbean from my application(SessionBean), it just works fine. (You can use HttpAdapter to manage those MBeans.)

                      I hope it helps