Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0.4
-
None
-
Operating System: other
Platform: Other
-
38626
Description
LogFactory checks for the existence of Thread#getContextClassLoader every time
#getLogFactory is invoked and does a reflective invocation. This is
unnecessarily expensive if many Log objects are created. An easy patch is to
remember the Method object; the lookup happens only once and it will massively
profit from reflection optimizations after a number of calls (a Java code stub
is generated by the reflection package).
Patch:
419a420,426
> private static Method GET_CONTEXT_CLASS_LOADER = null;
> static {
> try
catch (NoSuchMethodException e)
{ > }> }
436,439c443
< try {
< // Are we running on a JDK 1.2 or later system?
< Method method = Thread.class.getMethod("getContextClassLoader", nu
ll);
<
—
> if(GET_CONTEXT_CLASS_LOADER != null)
catch (NoSuchMethodException e)
{ --- > }else {