Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-6291

EJB scheduler Timeout invoking every 3 seconds inspite of ScheduleExpression

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 8.2.1.Final
    • 8.1.0.Final, 8.2.0.Final
    • EJB
    • Hide

      Deploy following code in Wildfly 8.2.0 or 8.1.0.Final

      @Singleton
      @Startup
      public class IntervalDemo {
      @Resource
      private TimerService timerService;

      @PostConstruct
      private void init()

      { TimerConfig config = new TimerConfig(); config.setPersistent(false); System.out.println("...initializing timer..."); ScheduleExpression exp = new ScheduleExpression(); exp.hour("*").minute("*"); exp.second("*/5"); timerService.createCalendarTimer(exp,config); }

      @Timeout
      public void process(Timer timer)

      { System.out.println(">> Current Time " + new Date()); }

      }

      Observed output:

      18:18:34,792 INFO [stdout] (EJB default - 3) >> Current Time Fri Feb 26 18:18:34 IST 2016
      18:18:34,938 INFO [stdout] (EJB default - 4) >> Current Time Fri Feb 26 18:18:34 IST 2016
      18:18:35,001 INFO [stdout] (EJB default - 8) >> Current Time Fri Feb 26 18:18:35 IST 2016
      18:18:35,036 INFO [stdout] (EJB default - 1) >> Current Time Fri Feb 26 18:18:35 IST 2016
      18:18:35,116 INFO [stdout] (EJB default - 5) >> Current Time Fri Feb 26 18:18:35 IST 2016
      18:18:35,255 INFO [stdout] (EJB default - 9) >> Current Time Fri Feb 26 18:18:35 IST 2016
      18:18:35,288 INFO [stdout] (EJB default - 7) >> Current Time Fri Feb 26 18:18:35 IST 2016

      Show
      Deploy following code in Wildfly 8.2.0 or 8.1.0.Final @Singleton @Startup public class IntervalDemo { @Resource private TimerService timerService; @PostConstruct private void init() { TimerConfig config = new TimerConfig(); config.setPersistent(false); System.out.println("...initializing timer..."); ScheduleExpression exp = new ScheduleExpression(); exp.hour("*").minute("*"); exp.second("*/5"); timerService.createCalendarTimer(exp,config); } @Timeout public void process(Timer timer) { System.out.println(">> Current Time " + new Date()); } } Observed output: 18:18:34,792 INFO [stdout] (EJB default - 3) >> Current Time Fri Feb 26 18:18:34 IST 2016 18:18:34,938 INFO [stdout] (EJB default - 4) >> Current Time Fri Feb 26 18:18:34 IST 2016 18:18:35,001 INFO [stdout] (EJB default - 8) >> Current Time Fri Feb 26 18:18:35 IST 2016 18:18:35,036 INFO [stdout] (EJB default - 1) >> Current Time Fri Feb 26 18:18:35 IST 2016 18:18:35,116 INFO [stdout] (EJB default - 5) >> Current Time Fri Feb 26 18:18:35 IST 2016 18:18:35,255 INFO [stdout] (EJB default - 9) >> Current Time Fri Feb 26 18:18:35 IST 2016 18:18:35,288 INFO [stdout] (EJB default - 7) >> Current Time Fri Feb 26 18:18:35 IST 2016

      When I write a EJB Scheduler using TimerService and ScheduleExpression. @Timeout function is invoking every 3 seconds inspite of the configured minutes / seconds.

              tadamski@redhat.com Tomasz Adamski
              surendrand001 Surendran Duraisamy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: