Caching "new InitialContext"


EJB programming & troubleshooting: Caching "new InitialContext"

  1. Caching "new InitialContext" (3 messages)

    Is is advisable to cache the "new IniialConext()" object and then using this one cached object for looking up Home Objects and DataSource Objects across the entire application.
  2. Caching "new InitialContext"[ Go to top ]

    Yep, I do it and it works well. Getting a new InitialContext each time would be fairly expensive.
  3. A followup question: How does it work in a clustered environment?

  4. Using a cached InitialContext within a clustered environment would rely on how your app server works. I have been using WebLogic and it allows you to specify the DNS name of your cluster when you create a Context, so if one machine goes down your Context will still be able to access the JNDI tree's from other servers.