• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question on Timeout Callbacks for Programmatic Timers

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Mohit G Gupta
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks James
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic