So it's amazing how hard it is to find any thorough information on JNDI wrt real world usage ... Anyone know if it is bad form to hold onto an InitialContext forever? There are comments in many places that it can be expensive to instantiate an InitialContext, but it's never made clear what the true cause of the performance loss is (I suppose it might be impl-dependent). The thing that concerns me is thta if that InitialContext is backed by a Socket or DB Connection, can it go stale if I hold onto it for too long, or does the spec require that it can take care of itself properly? And while I have you (hopefully
) here, what's the best practice on JNDI caching? One would hope a smart appserver would implement caching in the JNDI impl that you get handed back, but it's clearly not a guarantee ... And the few references I've found seem to impl that you have to do appserver-specific configuration settings to ensure caching (which sucks if that's true).
[rant]
And while we're on the subject, EJB/JNDI/etc really get on my nerves ... Maybe I'm missing something fundamental, but IMHO, how a group of professional developers could crap out such a terrible set of specifications never ceases to amaze me. I suspect all of these API's are a victim of design-by-committee, though, rather than the personal atrocities of a few. But a factory called a Home? What the hell kind of name is that? Naming is so important in programming, and it appears that the EJB people went to the University of Worst...Names...Ever. Requiring people to implement sets of methods that have particular magical names and you have to make sure they have a set of mutually consistent parameters? Just goes against the Java Way(TM) ... This was the best they could come up with?
[/rant]
ms