001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache license, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the license for the specific language governing permissions and
015 * limitations under the license.
016 */
017package org.apache.logging.log4j.spi;
018
019import java.util.HashMap;
020import java.util.Map;
021
022/**
023 * {@code ThreadContextMap} implementation used when either of system properties {@code disableThreadContextMap} or .
024 * {@code disableThreadContext} is {@code true}. This implementation does nothing.
025 *
026 * @since 2.7
027 */
028public class NoOpThreadContextMap implements ThreadContextMap {
029    @Override
030    public void clear() {
031    }
032
033    @Override
034    public boolean containsKey(final String key) {
035        return false;
036    }
037
038    @Override
039    public String get(final String key) {
040        return null;
041    }
042
043    @Override
044    public Map<String, String> getCopy() {
045        return new HashMap<>();
046    }
047
048    @Override
049    public Map<String, String> getImmutableMapOrNull() {
050        return null;
051    }
052
053    @Override
054    public boolean isEmpty() {
055        return true;
056    }
057
058    @Override
059    public void put(final String key, final String value) {
060    }
061
062    @Override
063    public void remove(final String key) {
064    }
065}