This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Regarding JNDI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Regarding JNDI" Watch "Regarding JNDI" New topic

Regarding JNDI

LakshmiNarayana vishnu
Ranch Hand

Joined: Aug 03, 2006
Posts: 39
Hi Friends,
If there are 100 beans in JNDI & the context.lookup() method takes time to lookup. How do you handle the situation to make it easy retrieval of the bean ?

Please reply soon

Lucas Lee
Ranch Hand

Joined: Oct 02, 2006
Posts: 53
Of course you can wrap the context.lookup() statements to a utility method.
For example,wrap to util.getRemoteObject(jndiName),for more simplicity,util.getA(),util.getB(),etc,but need more code.
karthikeyan Chockalingam
Ranch Hand

Joined: Sep 06, 2003
Posts: 259
Also try caching the EJBs home interface (EJBHomeFactory)

S Venkatesh
Ranch Hand

Joined: Jun 27, 2005
Posts: 464

It is always a good practise to cache the JNDI when the application server comes up and use the same cache for the lookup. You can look at the service locator design pattern for more info on this.
I agree. Here's the link:
subject: Regarding JNDI
It's not a secret anymore!