2 Replies Latest reply on May 1, 2008 2:53 AM by Zahid Maqbool

    Asynchronous Quartz method called only once

    Nicklas Karlsson Master

      Is there any magic involved with interval-timers in WAR deployments? I have the Quartz scheduler configured in components.xml and I see it start up. I observe the seam post initialization event and it calls my method


      
      @Asynchronous
      
      public QuartzTriggerHandle sync(@Expiration Date start, @IntervalDuration long interval) {
      
      



      but only once. What could case the interval (60000) to be ignored? Missing the intercept?


      I'm running Seam 2.0.1.GA on JBoss 4.2.2.GA

        • 1. Re: Asynchronous Quartz method called only once
          Nicklas Karlsson Master

          Nicklas Karlsson wrote on Mar 03, 2008 10:06 AM:

          What could case the interval (60000) to be ignored? Missing the intercept?


          More like cached classes somewhere. Got it working now. Awarding 5 stars to myself...

          • 2. Re: Asynchronous Quartz method called only once
            Zahid Maqbool Newbie

            Hey Nicholas I also have the same problem....


            Can you tell me how to solve this problem here is my piece of code...




            @Transactional
            @Name("startupTesting")
            public class StartupTesting {
            
                 @Logger
                 private Log log;     
                 
                 @In JbpmContext jbpmContext;
            
            
                 /**
                  * This is called by seam after initialization
                  * has finished.
                  */
                 @Observer("org.jboss.seam.postInitialization")
                 public void observe() 
                 {
                      try
                      {
                           Calendar cal = Calendar.getInstance ();
                           cal.set (2040, Calendar.MAY, 10);
                           schedulePayment(new Date(), 60*1000L, cal.getTime());
                           
                      }
                      catch(Exception e)
                      {
                           e.printStackTrace();
                           log.info("Operation Failed");
                      }
                      log.info("About to load system properties");
            
                 }
                 
                 
                 
                 
                 @Asynchronous
                 public QuartzTriggerHandle schedulePayment(@Expiration Date when,
                 @IntervalDuration Long interval,
                 @FinalExpiration Date endDate
                 )
                 {
                 // do the repeating or long running task until endDate
                      System.out.println("\n\n\n\n-------------------------------------" +
                                "Scheduler Started, Executing Job to Process AFS Response Downloader and State Progressor----------------\n\n\n\n");
                      QuartzTriggerHandle handle = new QuartzTriggerHandle("AFSTrigger");
            
                      log.info("Trying to load Test Jbpm Process Instance");
                      
                      org.jbpm.graph.exe.ProcessInstance pi = jbpmContext.loadProcessInstance(60787l);
                      
                      System.out.println(pi.getKey()+" ----- "+pi.getStart());
                      
                      
                      
                      return handle;
                 }
            }




            Would really appreciate your help