Github user leventov commented on a diff in the pull request:

    https://github.com/apache/logging-log4j2/pull/71#discussion_r115512718
  
    --- Diff: 
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/StringBuilderEncoder.java
 ---
    @@ -32,9 +32,14 @@
     public class StringBuilderEncoder implements Encoder<StringBuilder> {
     
         private static final int DEFAULT_BYTE_BUFFER_SIZE = 8 * 1024;
    -    private final ThreadLocal<CharBuffer> charBufferThreadLocal = new 
ThreadLocal<>();
    -    private final ThreadLocal<ByteBuffer> byteBufferThreadLocal = new 
ThreadLocal<>();
    -    private final ThreadLocal<CharsetEncoder> charsetEncoderThreadLocal = 
new ThreadLocal<>();
    +    /**
    +     * This ThreadLocal uses raw and inconvenient Object[] to store three 
heterogeneous objects (CharEncoder, CharBuffer
    --- End diff --
    
    @jvz I can. Using just one is an optimization - ThreadLocalMap is polluted 
less, ThreadLocalMap.get() is called only once instead of three times.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to