2 Replies Latest reply on Jan 29, 2012 5:05 AM by Noa Drach

    Avoiding concurrent invocations of an automatically scheduled bean

    Noa Drach Novice

      Hello All,

       

      previously we used quartz and org.quartz.StatefulJob to make sure that a scheduled method will not be invoked if the previous method didn't complete it's work.

       

      is there a way to achieve the same behavior when using EJB3.1 and @Schedule?

       

      I tried to play with -

      1. getting the handle at the beginning of the method

      2. canceling the timer

      3. executing the BL

      4. requesting the handle from the timer

       

      this is based on http://docs.oracle.com/javaee/6/tutorial/doc/bnboy.html

       

      but i get many errors (running on jboss-as-7.1.0.CR1b)

       

      does any one know if there is a way to do the above scenario?

       

      thanks,

      Noa

        • 1. Re: Avoiding concurrent invocations of an automatically scheduled bean
          Ilia Ternovykh Newbie

          If you've already got running infrastructure using Quartz service why you've decided to move this into EJB? I would suggest to do processing logic inside quartz and push results into Application Server using some JMS solution (HornetQ or ActiveMQ).

           

          E.g. your quartz service performs some processing logic then sends serialized results to the application server using JMS queue/topic for additional purposes. Please provide more details about your solution and goals

          • 2. Re: Avoiding concurrent invocations of an automatically scheduled bean
            Noa Drach Novice

            I am just considering my options when migrating for jboss 4.2.3 that had quartz embedded and I used the resources adapter to have an MDB that uses quartz.

             

            but now in jboss 7.1 quartz is not distributed and I was wondering if there is a replacement to it's capabilities.

             

            basically my scenario is as follows -

            I use an MDB registered to quartz to do some pulling on data

            the data is analyzed

            and than the whole cycle starts again.

             

            the thing is i don't want the cycle to start again if the processing of the current data takes longer than the diff between the invocations.

             

            i know i can always set the time longer, but it doesn't grantee that there won't be overlapping