• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on Timeout Callbacks for Programmatic Timers

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source: EJB 3.1 Specification

18.2.5.1 Timeout Callbacks for Programmatic Timers


A.All timers created via one of the TimerService timer creation methods for a particular component use a
single timeout callback method. This method may be a
i)method annotated with the Timeoutannotation
(or a method specified as a timeout method in the deployment descriptor) or
ii) the bean may implement the javax.ejb.TimedObjectinterface.

B.If the bean implements the TimedObjectinterface, the Timeoutannotation or timeout-method
deployment descriptor element can only be used to specify the ejbTimeoutmethod


As stated in statment B,the Timeoutannotation or timeout-method deployment descriptor element can only be used to specify the ejbTimeoutmethod.
Question: Can someone provide a example explaining the same ?
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James for the reply.
However I still have queries

As stated in Statement A,Timeoutannotation or timeout method in the deployment descriptor are used to specify single timeout callback method.
and Statement B says that If the bean implements the TimedObjectinterface, the Timeoutannotation or timeout-method deployment descriptor element can only be used to specify the ejbTimeoutmethod

ejbTimeoutmethod is also timeout callback method

The 2 statement looks similar But I see there is on text(see text in bold) that creates a difference.
Question:Can someone throw more light on the text ?
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohit

My last post is not correct so apologies first for that.

What the statement in bold means is that should you implement the TimedObject interface, you can only annotate or specify in the descriptor file the ejbTimeout method as the timeout method.

So, as an example, this code would be valid:

But this code would be invalid:
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic