[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-720) Timeout annotation doesn't work on protected method

Ilya (JIRA) jira-events at jboss.com
Mon Oct 2 03:47:41 EDT 2006


Timeout annotation doesn't work on protected method
---------------------------------------------------

                 Key: EJBTHREE-720
                 URL: http://jira.jboss.com/jira/browse/EJBTHREE-720
             Project: EJB 3.0
          Issue Type: Bug
    Affects Versions: EJB 3.0 RC9 - FD
            Reporter: Ilya
            Priority: Minor


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();
   }
}
---------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list