3 Replies Latest reply on Aug 23, 2011 6:22 AM by notify

    @Schedule on Stateless EJB 3.1 on JBoss 6.0 Final

    notify

      I have a very simple stateless session bean deployed on JBoss 6.0 Final (part of a Seam 2.2.2 Final App)

       

      I have a method;

       

      @Schedule(second="*", minute="*/1")

      public void publishToDevice(Time timer) {

           log.info("Do something every minute .....");

      }

       

      I expected it to print a message in the JBoss Console every minute?

       

      It doesn't. Any suggestions?

       

      Thanks

        • 1. Re: @Schedule on Stateless EJB 3.1 on JBoss 6.0 Final
          jlaskowski

          Hi,

           

          Use @Schedule(second = "*", minute = "*/1", hour = "*", info="Every 1 minute") to achieve it. According to 18.2.1.2 Expression Rules of the EJB 3.1 spec - hour defaults to 0 and that's what postpones the timer around the midnight.

           

          Jacek

          • 2. Re: @Schedule on Stateless EJB 3.1 on JBoss 6.0 Final
            notify

            Thanks.

             

            I did try that in all my permutations.

             

            Have added it back and it still sits there, not executing the method.

             

            /**

              * publishToDevice

            */

            @Schedule(second = "*", minute = "*/1", hour = "*", persistent=false)

            public void publishToDevice(Timer timer) {

                log.info(">>>>> publishToDevice= " + Calendar.getInstance().getTime());

            }

            • 3. Re: @Schedule on Stateless EJB 3.1 on JBoss 6.0 Final
              notify

              Changed the Stateless Session bean to Singleton added annotations to my SB;

               

              @Singleton

              @StartUp

               

              and modified the ejb-jar.xml

               

              to be;

               

              <session-type>Singleton<session-type>

               

              and

               

              <init-on-start-up>true<init-on-start-up>

               

              the @Schedule

               

              starts on JBoss start-up.

               

              and prints my message to the JBoss log.