This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
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.
posted 6 years ago
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.