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

Recurring Timers are called concurrently

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 9.0.0.Alpha1
    • 8.1.0.Final
    • EJB
    • Hide

      Test case

      @Singleton
      @Lock(LockType.READ)
      @Startup
      public class MyScheduler {
          
          private static final Logger LOGGER = Logger.getLogger(MyScheduler.class.getName());
          
          @Schedule(hour = "*", minute = "*", second = "0/30")
          public void performOperation() {
              try {
                  String id = UUID.randomUUID().toString();
                  Object[] params = new Object[]{id,LocalDateTime.now(),Thread.currentThread().getName()}; 
                  LOGGER.log(Level.INFO,"Starting operation {0} at {1} in thread {2} ",  params);
                  long pause= Duration.ofMinutes(1).toMillis();
                  Thread.sleep(pause);
                  LOGGER.info("Done performing operation: " + id);
              } catch (InterruptedException ex) {
                  LOGGER.log(Level.SEVERE, null, ex);
              }
          }
          
          
      }
      
      Show
      Test case @Singleton @Lock(LockType.READ) @Startup public class MyScheduler { private static final Logger LOGGER = Logger.getLogger(MyScheduler. class. getName()); @Schedule(hour = "*" , minute = "*" , second = "0/30" ) public void performOperation() { try { String id = UUID.randomUUID().toString(); Object [] params = new Object []{id,LocalDateTime.now(), Thread .currentThread().getName()}; LOGGER.log(Level.INFO, "Starting operation {0} at {1} in thread {2} " , params); long pause= Duration.ofMinutes(1).toMillis(); Thread .sleep(pause); LOGGER.info( "Done performing operation: " + id); } catch (InterruptedException ex) { LOGGER.log(Level.SEVERE, null , ex); } } }

      According to https://docs.jboss.org/author/display/WFLY8/EJB+3+Reference+Guide recurring timers should not be executed concurrently.

      That is not the case. I don't think the current behavior is actually expected.

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              cbarragan_jira Carlos Barragan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: