4 Replies Latest reply on Sep 13, 2017 8:53 AM by wwang2016

    The real purpose of "refresh-interval" in EJB timer service (wildfly 10.1.0.Final)

    wwang2016

      Hi,

       

      I am testing setting EJB timer/scheduler in a wildfly cluster with two instances (#1 and #2)

       

      I had a basic configuration that is actually working. Either of the instances will invoke the scheduler at specified time, no repeating invocation was happening. This is good.

       

      However, I also understand there is a parameter called "refresh-interval" which I did not set it up. Based on the model reference (Wildfly Model Reference ) ,

      • refresh-interval Interval between refreshing the current timer set against the underlying database. A low value means timers get picked up more quickly, but increase load on the database.

       

      The default value is -1

       

      It looks like a parameter that can affect performance.

       

      I am not very clear as to what this parameter does. When I decompiled a java class called DatabaseTimerPersistence.java, and found the method start(StartContext context), it has the following code:

       

              if(refreshInterval > 0)

              {

                  refreshTask = new RefreshTask();

                  ((Timer)timerInjectedValue.getValue()).schedule(refreshTask, refreshInterval, refreshInterval);

              }

       

      It seems to me that the default value will not invoke the above code.

       

      However, I can see clearly the scheduler in cluster environment worked fine (schedule to invoke the job every 30 seconds)

       

      Can anyone share with me what it does?

       

      Thanks

       

      Wayne