Hi,
If I am caching the EJBHome and InitialContext in implementing the servicelocator pattern, do I need to close the context after every EJB transaction using Context.close() method in the finally block?
Any suggestion in this is highly appreciated.
Thanks
Suneer
-
ejbhome and initialcontext caching (4 messages)
- Posted by: _ejb _java
- Posted on: August 02 2004 07:37 EDT
Threaded Messages (4)
- ejbhome and initialcontext caching by Rene Zanner on August 02 2004 11:16 EDT
- ejbhome and initialcontext caching by _ejb _java on August 03 2004 00:38 EDT
-
ejbhome and initialcontext caching by Rene Zanner on August 03 2004 07:32 EDT
- ejbhome and initialcontext caching by _ejb _java on August 04 2004 09:43 EDT
-
ejbhome and initialcontext caching by Rene Zanner on August 03 2004 07:32 EDT
- ejbhome and initialcontext caching by _ejb _java on August 03 2004 00:38 EDT
-
ejbhome and initialcontext caching[ Go to top ]
- Posted by: Rene Zanner
- Posted on: August 02 2004 11:16 EDT
- in response to _ejb _java
Hi,
usually you should not need to close the InitialContext. I suppose the EJB container should do this for you. Anyway - I know of at least one EJB container (BEA Weblogic) which does not close the context after lookup. That causes problems with security (Principals switch depending on the Identity used for the lookup!).
So - close the InitialContext after the lookup. It seems good style to me.
Cheers,
René Zanner -
ejbhome and initialcontext caching[ Go to top ]
- Posted by: _ejb _java
- Posted on: August 03 2004 00:38 EDT
- in response to Rene Zanner
Thanks very much for your suggestion.
I use BEA Weblogic 6.1. I want to cache the initial context and EJBHome.
Now, if I close the context every time in the finally block, will I still be able to use the cached context/ Home interface?
Thanks,
Suneer -
ejbhome and initialcontext caching[ Go to top ]
- Posted by: Rene Zanner
- Posted on: August 03 2004 07:32 EDT
- in response to _ejb _java
Hi,
it should be enough to cache the Home interfaces. We do that in our ServiceLocator pattern: we have a EjbHomeFactory which caches the Home interfaces in a Map.
Why do you want to cache the InitialContext? I'm afraid that when you close it, you can't use it any longer for lookups.
Cheers,
René -
ejbhome and initialcontext caching[ Go to top ]
- Posted by: _ejb _java
- Posted on: August 04 2004 09:43 EDT
- in response to Rene Zanner
Hi René,
Thanks very much for your suggestion.
I will implement your suggestions.
Thanks again...
Suneer