This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Invoking getTimerService method from Session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Invoking getTimerService method from Session bean" Watch "Invoking getTimerService method from Session bean" New topic
Author

Invoking getTimerService method from Session bean

Vijay Ramalingam
Greenhorn

Joined: Jun 02, 2006
Posts: 18
In stateless session bean getTimerService can be invoked only from business or web service enpoint method. Why ihe invocation is disallowed in setSessionContext, ejbCreate or ejbRemove methods.

Please clarify the exact condition from the getTimerService method could be invoked from session bean.
S Bhanage
Greenhorn

Joined: Oct 28, 2009
Posts: 13
Hi,

getTimerService() is method from EJBContext used to get TimerService object.


It can not be invoked from
1) setSessionContext - becoz EJBContext/SessionContext is not initialised for use.
2) ejbCreate - becoz dependency injection methods (e.g. setSessionContext) are invoked after this method
3) ejbRemove - becoz there is no way to ensure when this method gets called
by the container in case of stateless bean. So not useful to get timer service instance.

Hope this helps you.
 
Consider Paul's rocket mass heater.
 
subject: Invoking getTimerService method from Session bean
 
Similar Threads
SLSB
Valid operation in ejbCreate for stateless session bean
Can a stateless session bean client call the remove()
Invoking Timer methods from stateful/stateless session bean
Session Bean Methods Call