I'm wondering about the cost of doing JNDI lookups.. Here's the setup:
1. A business tier has a dozen or so stateless beans that make requests to the back end system and return a result to the caller.
2. a remote web client does a JNDI lookup to one or more of the beans, and may invoke one or more methods on the same remote bean during the POST or GET request.
- do i need to close the JNDI connection when I'm done (i.e. before exiting the POST or GET method of the servlet)?
- is it feasible to have a singleton that holds the jndi connection open? or do I really need to do a new lookup each time I need a stateless bean?
I guess my main concern is the cost of doing the lookup. In all code examples I've seen, when accessing a remote ejb, the lookup is performed each time a bean is required, but I never see code to close the connection.