LOG4J2-1349 add Accessor utility for package-protected method getThreadContextMap
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/fcb58f14 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/fcb58f14 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/fcb58f14 Branch: refs/heads/LOG4J2-1349-gcfree-threadcontext Commit: fcb58f14ba6686ab607129c26633a9b72ba92a61 Parents: ffdd2d9 Author: rpopma <[email protected]> Authored: Sun Aug 21 10:37:02 2016 +0900 Committer: rpopma <[email protected]> Committed: Tue Aug 23 00:31:14 2016 +0900 ---------------------------------------------------------------------- .../logging/log4j/ThreadContextAccess.java | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fcb58f14/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java b/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java new file mode 100644 index 0000000..2e2a992 --- /dev/null +++ b/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ + +package org.apache.logging.log4j; + +import org.apache.logging.log4j.spi.ThreadContextMap; + +/** + * <em>This class is intended for internal log4j2 usage and should not be used directly by applications.</em> + * <p> + * Utility class to access package protected methods in {@code ThreadContext}. + * </p> + * + * @see ThreadContext + * @since 2.7 + */ +public final class ThreadContextAccess { + private ThreadContextAccess() { // this class should not be instantiated + } + + /** + * Returns the internal data structure used to store thread context key-value pairs. + * <p><em> + * This method is intended for internal log4j2 usage. + * The returned data structure is not intended to be used directly by applications. + * </em></p> + * @return the internal data structure used to store thread context key-value pairs + */ + public static ThreadContextMap getThreadContextMap() { + return ThreadContext.getThreadContextMap(); + } +}
