logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpo...@apache.org
Subject svn commit: r1532438 - in /logging/log4j/log4j2/trunk: log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java src/changes/changes.xml
Date Tue, 15 Oct 2013 17:07:22 GMT
Author: rpopma
Date: Tue Oct 15 17:07:22 2013
New Revision: 1532438

URL: http://svn.apache.org/r1532438
Log:
LOG4J-323 memory leak fix for AsyncLogger

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java?rev=1532438&r1=1532437&r2=1532438&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLogger.java
Tue Oct 15 17:07:22 2013
@@ -83,7 +83,7 @@ public class AsyncLogger extends Logger 
 
     private static ExecutorService executor = Executors
             .newSingleThreadExecutor(new DaemonThreadFactory("AsyncLogger-"));
-    private final ThreadLocal<Info> threadlocalInfo = new ThreadLocal<Info>();
+    private static ThreadLocal<Info> threadlocalInfo = new ThreadLocal<Info>();
 
     static {
         final int ringBufferSize = calculateRingBufferSize();
@@ -262,5 +262,6 @@ public class AsyncLogger extends Logger 
             }
         }
         executor.shutdown(); // finally, kill the processor thread
+        threadlocalInfo = new ThreadLocal<Info>(); // LOG4J2-323
     }
 }

Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1532438&r1=1532437&r2=1532438&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Tue Oct 15 17:07:22 2013
@@ -21,6 +21,10 @@
   </properties>
   <body>
     <release version="2.0RC1" date="2013-MM-DD" description="Bug fixes and enhancements">
+      <action issue="LOG4J2-323" dev="rpopma" type="fix">
+        Resolved memory leak by releasing reference to ThreadLocal when 
+        AsyncLogger is stopped.
+      </action>
       <action issue="LOG4J2-425" dev="rpopma" type="fix">
         Resolved memory leak by populating AsyncLoggerConfigHelper ring buffer 
         via EventTranslatorTwoArg, eliminating the need for a ThreadLocal.



Mime
View raw message