0 Replies Latest reply on Jul 14, 2016 4:57 AM by typek_pb

    EJB3 clustered timer, once server stopped, no other server (in domain/group) takes over

    typek_pb

      I'm using Wildfly 9.0.2 and jdk 1.8.

       

      I followed: http://www.mastertheboss.com/jboss-server/wildfly-8/creating-clustered-ejb-3-timers

      and created the clustered timer, which runs every 5 seconds.

       

      I have running domain of:

      - 1 master

      - 2 slaves, each have 2 servers configured (all in the same group)

       

      @Singleton

      @Startup

      public class FooEJB {

       

          @Schedule(hour = "*", minute = "*", second = "*/5", info ="foo timer",persistent=true)

          public void printDate() {   

              System.out.println("It is " + new java.util.Date().toString());

          }

      }

       

      I've configured my domain.xml respectively:

       

      <datasource jta="true" jndi-name="java:/jdbc/fooDS" pool-name="pgre" enabled="true" use-ccm="true">

                              <connection-url>jdbc:postgresql://db_host/foodb</connection-url>

                              <transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-isolation>

                              <driver>postgresql</driver>

                              <security>

                                  <user-name>foo</user-name>

                                  <password>pwd/password>

                              </security>

                              <validation>

                                  <validate-on-match>false</validate-on-match>

                                  <background-validation>false</background-validation>

                              </validation>

                              <timeout>

                                  <set-tx-query-timeout>false</set-tx-query-timeout>

                                  <blocking-timeout-millis>0</blocking-timeout-millis>

                                  <idle-timeout-minutes>0</idle-timeout-minutes>

                                  <query-timeout>0</query-timeout>

                                  <use-try-lock>0</use-try-lock>

                                  <allocation-retry>0</allocation-retry>

                                  <allocation-retry-wait-millis>0</allocation-retry-wait-millis>

                              </timeout>

                              <statement>

                                  <share-prepared-statements>false</share-prepared-statements>

                              </statement>

                          </datasource>

       

       

      ...

       

      <timer-service thread-pool-name="default" default-data-store="clustered-store">

                          <data-stores>

                              <database-data-store name="clustered-store" datasource-jndi-name="java:/jdbc/fooDS" database="postgresql" partition="timer" refresh-interval="10000"/>

                          </data-stores>                   

                      </timer-service>

      ..

       

       

      All works nicely => Only 1 timer is executed (every 5 secs), as I see in the log file, as well as in the DB the table jboss_ejb_timer.

       

      However, once I stop the server that has the DB lock (=> runs the timer), no other server takes over unless there is a new server started.

      Is there a way for all those, that didn't retrieve the lock originally, to retry with some interval?