Posted By:
Stan_UA1OUT
Posted On:
Wednesday, November 21, 2001 07:22 AM
Hi everyone, Thanks to all of you who ask questions and especially to those who find time to answer them. You have helped me very much already. I've got a few generic questions about EJBeans. I marked them in the text with Qs. Answers to any of them would be appreciated. InitialContext. The close method of the interface is supposed to be called to free resources. It seems to be a common practice never to use it (from what I see in examples and others code). Usually I new InitialContext in ejbCreate, store a reference in a class member of the bean and free it in ejbRemove. Q1: Is my approach ok? Q2: Should I use close at all? Stateless beans. Q3: Do I need to always
More>>
Hi everyone,
Thanks to all of you who ask questions and especially to those who find time to answer them. You have helped me very much already.
I've got a few generic questions about EJBeans. I marked them in the text with Qs. Answers to any of them would be appreciated.
InitialContext. The close method of the interface is supposed to be called to free resources. It seems to be a common practice never to use it (from what I see in examples and others code). Usually I new InitialContext in ejbCreate, store a reference in a class member of the bean and free it in ejbRemove. Q1: Is my approach ok? Q2: Should I use close at all?
Stateless beans. Q3: Do I need to always remove them after use (both on the client and in other beans)? Q4: Would Weblogic take care of the situation when remove is not called for a bean (or a lot of beans)?
Missed ejbRemoves. EJB 2.0 specs describes cases when ejbRemote does not get called. In ejbRemove I would normally free resource I allocated in ejbCreate (context, references to other beans, etc). Q5: Is it ok to ignore missed removes?
Caching stateless beans. The following is what I normally do: in ejbCreate lookup JNDI to obtain homes of all beans I am going to use in all methods of the bean. In methods I get hold of remotes. When getting references to stateless beans, I guess, it would make sense to cache remote interfaces of the stateless beans in ejbCreate as well (Q6). There might be a situation when the server removes the bean on timeout. How would I handle it (Q7)? Q8: Is instantiating an EJBean using serialized handle any faster then going through JNDI lookup for home and ejbCreate for remote interface?
Thats it.
Thanks again.
Stan
<<Less