// Path: core/src/main/java/org/jboss/logmanager/LoggerNode.java
// static IllegalArgumentException attachmentsFull() {
//     return new IllegalArgumentException("Attachments map is full");
// }


import org.wildfly.common.Assert;
import org.wildfly.common.ref.Reference;
import org.wildfly.common.ref.References;
import java.security.AccessController;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import java.util.logging.LoggingMXBean;
import java.util.logging.LoggingPermission;
import static org.jboss.logmanager.LoggerNode.attachmentsFull;
     *
     * @param key the attachment key
     * @param value the attachment value
     * @param <V> the attachment value type
     * @return the old attachment, if there was one
     * @throws SecurityException if a security manager exists and if the caller does not have {@code LoggingPermission(control)}
     * @throws IllegalArgumentException if the attachment cannot be added because the maximum has been reached
     */
    @SuppressWarnings("unchecked")
    public <V> V attach(Logger.AttachmentKey<V> key, V value) throws SecurityException {
        checkAccess();
        Assert.checkNotNullParam("key", key);
        Assert.checkNotNullParam("value", value);
        V old;
        synchronized (this) {
            if (key == attachmentKey1) {
                old = (V) attachmentValue1;
                attachmentValue1 = value;
            } else if (key == attachmentKey2) {
                old = (V) attachmentValue2;
                attachmentValue2 = value;
            } else if (attachmentKey1 == null) {
                old = null;
                attachmentKey1 = key;
                attachmentValue1 = value;
            } else if (attachmentKey2 == null) {
                old = null;
                attachmentKey2 = key;
                attachmentValue2 = value;
            } else {
// Path: core/src/main/java/org/jboss/logmanager/LoggerNode.java
// static IllegalArgumentException attachmentsFull() {
//     return new IllegalArgumentException("Attachments map is full");
// }


// Path: core/src/main/java/org/jboss/logmanager/LogContext.java
import org.wildfly.common.Assert;
import org.wildfly.common.ref.Reference;
import org.wildfly.common.ref.References;
import java.security.AccessController;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import java.util.logging.LoggingMXBean;
import java.util.logging.LoggingPermission;
import static org.jboss.logmanager.LoggerNode.attachmentsFull;

     *
     * @param key the attachment key
     * @param value the attachment value
     * @param <V> the attachment value type
     * @return the old attachment, if there was one
     * @throws SecurityException if a security manager exists and if the caller does not have {@code LoggingPermission(control)}
     * @throws IllegalArgumentException if the attachment cannot be added because the maximum has been reached
     */
    @SuppressWarnings("unchecked")
    public <V> V attach(Logger.AttachmentKey<V> key, V value) throws SecurityException {
        checkAccess();
        Assert.checkNotNullParam("key", key);
        Assert.checkNotNullParam("value", value);
        V old;
        synchronized (this) {
            if (key == attachmentKey1) {
                old = (V) attachmentValue1;
                attachmentValue1 = value;
            } else if (key == attachmentKey2) {
                old = (V) attachmentValue2;
                attachmentValue2 = value;
            } else if (attachmentKey1 == null) {
                old = null;
                attachmentKey1 = key;
                attachmentValue1 = value;
            } else if (attachmentKey2 == null) {
                old = null;
                attachmentKey2 = key;
                attachmentValue2 = value;
            } else {
                throw attachmentsFull();