2 Replies Latest reply on Apr 21, 2010 2:02 PM by Tathagat Tathagat

    Quartz task runs only once on startup, but runs OK when started via GUI

    Tathagat Tathagat Newbie

      Hi all.


      I created a TaskScheduler




      @Name("taskScheduler")
      @AutoCreate
      @Scope(ScopeType.APPLICATION)
      public class TaskSchedulerService {
           private static Logger logger = Logger.getLogger(TaskSchedulerService.class);
           
      //     @In QuartzTriggerHandle timer;
           
           @Asynchronous
           @Transactional
           public QuartzTriggerHandle test(@Expiration Date when, @IntervalDuration Long interval) {
                logger.debug("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX: " + (new Date().toString()));
                return null;
           }
           
           @Observer("org.jboss.seam.postInitialization")
           public void startEmailCheck() {
                logger.debug("startEmailCheck - BEGIN");
                Date now = new Date();
                Long interval = new Long(10 * 1000);
                test(now, interval);
           }
      }



      It does nothing more than log date/time every 10 seconds.


      When I start my server (Jetty via maven) it logs the first statement and then nothing more. But if I call the method (startEmailCheck) using a button from GUI, it starts logging every 10 seconds.


      I think I am making an obvious mistake - may be fresh eyes will help me :).


      Thanks in advance.


      Cheers
      T