Quoting Ceki G�lc� <[EMAIL PROTECTED]>:

> At 08:24 PM 11/29/2004, you wrote:
> >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.)
>

If JNDIUtil.getInitialContext() fails, then store that fact as a boolean member
variable which will be true by default, but be set to false in the catch
statement.  We'd check the value of the boolean before attempting the
JNDIUtil.getInitialContext() stuff so, the next time getLoggerRepository() is
called, it would avoid doing any of the context stuff making the performance,
essentially, the same as the default selector.   Why should this have anything
to do with classloader?

Jake

>
> --
> 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]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to