org.apache.logging.log4j.spi

Class NoOpThreadContextMap

  • All Implemented Interfaces:
    ThreadContextMap


    public class NoOpThreadContextMap
    extends Object
    implements ThreadContextMap
    ThreadContextMap implementation used when either of system properties disableThreadContextMap or . disableThreadContext is true. This implementation does nothing.
    Since:
    2.7
    • Constructor Detail

      • NoOpThreadContextMap

        public NoOpThreadContextMap()
    • Method Detail

      • containsKey

        public boolean containsKey(String key)
        Description copied from interface: ThreadContextMap
        Determines if the key is in the context.
        Specified by:
        containsKey in interface ThreadContextMap
        Parameters:
        key - The key to locate.
        Returns:
        True if the key is in the context, false otherwise.
      • get

        public String get(String key)
        Description copied from interface: ThreadContextMap
        Gets the context identified by the key parameter.

        This method has no side effects.

        Specified by:
        get in interface ThreadContextMap
        Parameters:
        key - The key to locate.
        Returns:
        The value associated with the key or null.
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: ThreadContextMap
        Returns true if the Map is empty.
        Specified by:
        isEmpty in interface ThreadContextMap
        Returns:
        true if the Map is empty, false otherwise.
      • put

        public void put(String key,
                        String value)
        Description copied from interface: ThreadContextMap
        Puts a context value (the o parameter) as identified with the key parameter into the current thread's context map.

        If the current thread does not have a context map it is created as a side effect.

        Specified by:
        put in interface ThreadContextMap
        Parameters:
        key - The key name.
        value - The key value.
      • remove

        public void remove(String key)
        Description copied from interface: ThreadContextMap
        Removes the context identified by the key parameter.
        Specified by:
        remove in interface ThreadContextMap
        Parameters:
        key - The key to remove.

Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.