Repository: logging-log4j2
Updated Branches:
  refs/heads/master 0f3a45668 -> 0d4248da7


LOG4J2-1349 documented and renamed method getReadOnlyContextData() to clarify 
its intended usage


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/0d4248da
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0d4248da
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0d4248da

Branch: refs/heads/master
Commit: 0d4248da7e0f82f46fb1537749c16e181f23ebc6
Parents: 0f3a456
Author: rpopma <rpo...@apache.org>
Authored: Thu Sep 22 23:03:55 2016 +0900
Committer: rpopma <rpo...@apache.org>
Committed: Thu Sep 22 23:03:55 2016 +0900

----------------------------------------------------------------------
 .../log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java    | 2 +-
 .../log4j/spi/GarbageFreeSortedArrayThreadContextMap.java    | 2 +-
 .../java/org/apache/logging/log4j/spi/ThreadContextMap2.java | 7 ++++---
 .../logging/log4j/core/impl/ThreadContextDataInjector.java   | 8 ++++----
 .../main/java/org/apache/logging/slf4j/MDCContextMap.java    | 2 +-
 5 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0d4248da/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
----------------------------------------------------------------------
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
index 25746eb..9a93310 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
@@ -164,7 +164,7 @@ class CopyOnWriteSortedArrayThreadContextMap implements 
ThreadContextMap2, CopyO
      * {@inheritDoc}
      */
     @Override
-    public MutableContextData getMutableContextData() {
+    public MutableContextData getReadOnlyContextData() {
         final MutableContextData map = localMap.get();
         return map == null ? EMPTY_CONTEXT_DATA : map;
     }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0d4248da/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
----------------------------------------------------------------------
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
index 72482cf..4d3df3e 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
@@ -161,7 +161,7 @@ class GarbageFreeSortedArrayThreadContextMap implements 
ThreadContextMap2  {
      * {@inheritDoc}
      */
     @Override
-    public MutableContextData getMutableContextData() {
+    public MutableContextData getReadOnlyContextData() {
         MutableContextData map = localMap.get();
         if (map == null) {
             map = createMutableContextData();

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0d4248da/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
----------------------------------------------------------------------
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
index 7d1a520..396db68 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
@@ -39,10 +39,11 @@ public interface ThreadContextMap2 extends ThreadContextMap 
{
     void putAll(final Map<String, String> map);
 
     /**
-     * Returns the {@code MutableContextData}. Note that the returned context 
data may not be mutable; it may have been
-     * {@linkplain MutableContextData#freeze() frozen}, making the data 
structure read-only.
+     * Returns the context data for reading. Note that regardless of whether 
the returned context data has been
+     * {@linkplain MutableContextData#freeze() frozen} (made read-only) or 
not, callers should not attempt to modify
+     * the returned data structure.
      *
      * @return the {@code MutableContextData}
      */
-    MutableContextData getMutableContextData();
+    MutableContextData getReadOnlyContextData();
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0d4248da/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
index 8c72f70..b836163 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
@@ -118,14 +118,14 @@ public class ThreadContextDataInjector  {
             // modified.
             copyProperties(props, reusable);
 
-            final ContextData immutableCopy = 
ThreadContextAccess.getThreadContextMap2().getMutableContextData();
+            final ContextData immutableCopy = 
ThreadContextAccess.getThreadContextMap2().getReadOnlyContextData();
             reusable.putAll(immutableCopy);
             return reusable;
         }
 
         @Override
         public ContextData rawContextData() {
-            return 
ThreadContextAccess.getThreadContextMap2().getMutableContextData();
+            return 
ThreadContextAccess.getThreadContextMap2().getReadOnlyContextData();
         }
     }
 
@@ -151,7 +151,7 @@ public class ThreadContextDataInjector  {
         public MutableContextData injectContextData(final List<Property> 
props, final MutableContextData reusable) {
             // If there are no configuration properties we want to just return 
the ThreadContext's MutableContextData:
             // it is a copy-on-write data structure so we are sure 
ThreadContext changes will not affect our copy.
-            final MutableContextData immutableCopy = 
ThreadContextAccess.getThreadContextMap2().getMutableContextData();
+            final MutableContextData immutableCopy = 
ThreadContextAccess.getThreadContextMap2().getReadOnlyContextData();
             if (props == null || props.isEmpty()) {
                 return immutableCopy;
             }
@@ -164,7 +164,7 @@ public class ThreadContextDataInjector  {
 
         @Override
         public ContextData rawContextData() {
-            return 
ThreadContextAccess.getThreadContextMap2().getMutableContextData();
+            return 
ThreadContextAccess.getThreadContextMap2().getReadOnlyContextData();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0d4248da/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
----------------------------------------------------------------------
diff --git 
a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java 
b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
index a96537f..b709af8 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
@@ -84,7 +84,7 @@ public class MDCContextMap implements ThreadContextMap2 {
     }
 
     @Override
-    public MutableContextData getMutableContextData() {
+    public MutableContextData getReadOnlyContextData() {
         final Map<String, String> copy = getCopy();
         if (copy.isEmpty()) {
             return EMPTY_CONTEXT_DATA;

Reply via email to