4 Replies Latest reply on Feb 13, 2015 8:50 AM by Ernesto Pérez

    Sheduled EJB3  with reload a deploy.

    Ernesto Pérez Newbie

      Dear all

       

      I have scheduled ejb by programatic dates (but is the same with anottations)   with Wildfly 8.2.0.   when I reload the jar (and change the Timer scheduled)   Wildfly conserve the old programers and I have to delete all Timers from:

       

      wildfly-8.2.0.Final/standalone/data/timer-service-data

       

      I atach you example code:

       

      @Singleton(mappedName = "ListSchedule")

      @Startup

      @Lock(LockType.WRITE)

       

      @AccessTimeout(value = 0)

       

      public class TaskSchedule2 implements Serializable{

        

       

       

       

          /**

           *

           */

          private static final long serialVersionUID = 6309408448344242965L;

          private static final Logger LOGGER = LoggerFactory.getLogger(TaskSchedule2.class);

        

         

          @Resource TimerService timerService;

          /**

           * Default constructor.

           */

          public TaskSchedule2() {

             

          }

          @PostConstruct

          public void initialize(){

         

         

              try {

                 

            ScheduleExpression expression =new ScheduleExpression();

           

            expression.second(10).minute("*").hour("*");

           

               timerService.createCalendarTimer(expression);

           LOGGER.info(" programing Schedule with timer:{}",expression);

                 

             

              } catch ( NullPointerException  e) {

            LOGGER.error("Not possible initialize scheduled tasks:{}",e);

           

              }

        }

       

         

          @Timeout

          private void scheduledTimeout(final Timer t) {

                

                 LOGGER.info("Run at {}",new java.util.Date());

          }

         

       

      }

       

      the logs::

      (ServerService Thread Pool -- 81)  programing Schedule with timer:ScheduleExpression[second=10 minute=* hour=* dayOfWeek=* dayOfMonth=* month=* year=* start=null end=null timezone=]

      (EJB default - 1) Run at Thu Feb 12 18:13:10 CST 2015

      (EJB default - 2) Run at Thu Feb 12 18:14:10 CST 2015

      (EJB default - 3) Run at Thu Feb 12 18:15:10 CST 2015

       

       

       

       

      Later, I change expression.second(10).minute("*").hour("*");  to expression.second(30)..minute("*").hour("*");   Compile, replace jar in Wildfly and the logs:

      (ServerService Thread Pool -- 90)  programing Schedule with timer:ScheduleExpression[second=30 minute=* hour=* dayOfWeek=* dayOfMonth=* month=* year=* start=null end=null timezone=]

      (EJB default - 4) Run at Thu Feb 12 18:15:30 CST 2015

      (EJB default - 5) Run at Thu Feb 12 18:16:10 CST 2015

      (EJB default - 6) Run at Thu Feb 12 18:16:30 CST 2015

      (EJB default - 7) Run at Thu Feb 12 18:17:10 CST 2015

       

      I can solve getting in @PostConstruct   all timers and delete it, but  I think when I un-deploy or replace jar, Wildfly has to delete all data of old jar. It's an Issue?

       

      Thanks you in advance