Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2021 The Flogger Authors.
*
* Licensed 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 com.google.common.flogger.backend.log4j2;
import static com.google.common.flogger.util.Checks.checkNotNull;
import com.google.common.flogger.MetadataKey;
import com.google.common.flogger.context.Tags;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
/**
* A simple FIFO queue linked-list implementation designed to store multiple metadata values in a
* StringMap. There are two aspects worth pointing out:
*
*
First, it is expected that a value queue always contains at least a single item. You cannot
* add null references to the queue and you cannot create an empty queue.
*
*
Second, it is expected to access the contents of the value queue via an iterator only. Hence
* we do not provide a method for taking the first item in the value queue..
*
*
Metadata values in Flogger always have unique keys, but those keys can have the same label.
* Because Log4j2 uses a {@code String} keyed map, we would risk clashing of values if we just used
* the label to store each value directly. This class lets us store a list of values for a single
* label while being memory efficient in the common case where each label really does only have one
* value.
*/
final class ValueQueue implements Iterable