You mean cache the InitialContext OUTSIDE EJBs? So, you cache the instance, which keeps a connection open, the server is brought down and back up and the InitialContext isn't valid anymore; you have to recreate the instance? Is that it?
Use a wrapper class. It's difficult to come up with a snippet since there usually isn't a clean way of detecting that the IC has died; most likely, you'll have to add a try/catch clause into the lookup methods, detecting whether the IC has died(re-creating it and retrying the last operation, this time without catching anything), or not, in which case you show just rethrow the Exception. Within EJBs usually just letting the call fail discards the instance, and you can have the user manually retry the transaction. Using a wrapper class would do as well. Juan Pablo Lorandi Chief Software Architect Code Foundry Ltd. [EMAIL PROTECTED] Barberstown, Straffan, Co. Kildare, Ireland. Tel: +353-1-6012050 Fax: +353-1-6012051 Mobile: +353-86-2157900 www.codefoundry.com > -----Original Message----- > From: Catalfano Anthony [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 03, 2003 3:08 PM > To: Juan Pablo Lorandi; [EMAIL PROTECTED] > Subject: JNDI, initial contexts, caching, etc > > > Does anyone have some code that handles the following situation: > > -I'd like to cache the InitialContext for an EJB lookup for > performance > -When the EJB server is bounced, the client code breaks > -is there a common pattern for handling this and if so does > anyone have tested code for it > > Thanks > > > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
