|
From: Tim M. <tec...@mo...> - 2003-12-09 12:04:58
|
Colin Sampaleanu wrote: > I've modified the EJB support code to allow a user subclass of > AbstractStatelessSessionBean to call a new method unloadBeanFactory() > from ejbPassivate (which it should implement itself). The subclass > should call the existing loadBeanFactory() from ejbCreate() and > ejbActivate(). As well, the default implementation of ejbRemove which > is in AbstractEnterpriseBean now calls the new unloadBeanFactory() > method. There is one change that may affect some existing code, and > that is that in the process of adding the above, I modified the existing > BeanFactoryLoader interface to handle unloading as well as loading of a > beanfactory. > > These changes should allow you to use a Stateful Session bean properly > even wtih passivation and activation happening. > > Regards, > Colin Colin and others, We've come across another issue to do with the passivation of beans. While our stateful session bean holds an instance of the bean factory itself (and can control re-initialising it), it is very possible that other standalone beans have a copy of the bean factory as well. If the stateful session bean has references to these other beans then it becomes very difficult to handle. Is there any reason that the BeanFactory (and Loader) is not serializable. It would make it much easier to handle if they were. Example of problem: StatefulSessionBeanA HAS BusinessBeanB HAS BusinessBeanC HAD DAOBeanD + The Stateful Session bean will load the BeanFactory and lookup BusinessBeanB. + BusinessBeanB has the BeanFactory initialised through the ApplicationContext.xml file. + BusinessBeanB looks up BusinessBeanC using the BeanFactory. + BusinessBeanC initialising DAOBeanD through the ApplicationContext.xml file. In this case, the stateful session bean has problems serializing BusinessBeanB due to the BeanFactory (XMLBeanFactory in this case). Any thoughts? Many thanks! Tim PS did you mean AbstractStatelessSessionBean or AbstractStatefulSessionBean above? Stateless beans are not passivated/activated. |