Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-720

Timeout annotation doesn't work on protected method

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • EJB 3.0 RC9 - FD
    • None
    • None

    Description

      According to ejb3 spec:
      ------- ejb-3_0-fr-spec-ejbcore.pdf 18.2 (p. 484) ------------
      A Timeout method can have public, private, protected, or package level access. A Timeout method must not be
      declared as final or static.
      ---------------------------------------------------------------------------

      But when I declare timeoutHandler in ExampleTimerBean as protected JBoss throws an exception:
      11:39:18,271 ERROR [TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBException: No method has been annotated with @Timeout

      So, a testcase can be:
      ---------------------------------------------------------------------------
      package org.jboss.tutorial.timer.bean;

      import java.util.Date;
      import javax.annotation.Resource;
      import javax.ejb.Remote;
      import javax.ejb.SessionContext;
      import javax.ejb.Stateless;
      import javax.ejb.Timeout;
      import javax.ejb.Timer;

      @Stateless
      @Remote(ExampleTimer.class)
      public class ExampleTimerBean implements ExampleTimer
      {
      private @Resource SessionContext ctx;

      public void scheduleTimer(long milliseconds)

      { ctx.getTimerService().createTimer(new Date(new Date().getTime() + milliseconds), "Hello World"); }

      @Timeout
      protected void timeoutHandler(Timer timer)

      { System.out.println("---------------------"); System.out.println("* Received Timer event: " + timer.getInfo()); System.out.println("---------------------"); timer.cancel(); }

      }
      ---------------------------------------------------------------------------

      Attachments

        Activity

          People

            Unassigned Unassigned
            atamur Ilya (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: