At 08:10 PM 11/29/2004, Jacob Kjome wrote:
Maybe if no provider is found the first time it would skip the JNDI lookup all
other times, making the performance deficit inconsequential.
Nice idea but how do you distinguish between the first time and the next time? I think you can't.
If there is no JNDI, JNDIUtil.getInitialContext() call will always fail.
public LoggerRepository getLoggerRepository() {
String loggingContextName = null;
Context ctx = null;try {
ctx = JNDIUtil.getInitialContext();
loggingContextName = (String) JNDIUtil.lookup(ctx, Constants.JNDI_CONTEXT_NAME);
} catch (NamingException ne) {
// without JNDI we'll always land here
}
if (loggingContextName == null) {
return defaultRepository;
} else { ... }
}The only way to speed up the test would be to cache the results depending on the thread context classloader and we'd be back to ThreadDeathException hell. Anyway, I'd like to stick to the standard JNDI API without assuming that JNDI is just a hack around classloaders (which in reality it seems to be always the case.)
-- Ceki G�lc�
The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
