3 Replies Latest reply on Apr 16, 2009 10:12 AM by Björn Raupach

    Starting a timer on application start

    Björn Raupach Newbie


      maybe someone can help me with this one: For a maintance task I would like to run a stateless session bean timer once a day. I thought the combination with the Startup Annotation from Seam is the way to go, but nothing happens. Any ideas?

      public class SomeJobBean implements SomeJob {
        private static boolean isTimerSet;
        @Logger Log log;
        @Resource TimerService timerService;
        public void initSomeJob() {
          if (!isTimerSet) {
            long dayInMillis = 1000 * 60 * 60 * 24;
            timerService.createTimer(new Date(),now.getTimeInMillis);
            isTimerSet = true;
        public void doSomeTask(Timer timer) {
          // some more business logic

      I am using Seam 2.1.1 and JBoss AS 4.2.3

      Thanks in advance!