• Post Reply Bookmark Topic Watch Topic
  • New Topic

Invoking getTimerService method from Session bean

 
Vijay Ramalingam
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!