All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.javaagent.bootstrap.internal.ClassLoaderMatcherCacheHolder Maven / Gradle / Ivy

There is a newer version: 2.11.0-alpha
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.javaagent.bootstrap.internal;

import io.opentelemetry.instrumentation.api.internal.GuardedBy;
import io.opentelemetry.instrumentation.api.internal.cache.Cache;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

/**
 * A holder of all ClassLoaderMatcher caches. We store them in the bootstrap class loader so that
 * instrumentation can invalidate the ClassLoaderMatcher for a particular ClassLoader, e.g. when
 * {@link java.net.URLClassLoader#addURL(URL)} is called.
 *
 * 

This class is internal and is hence not for public use. Its APIs are unstable and can change * at any time. */ public final class ClassLoaderMatcherCacheHolder { @GuardedBy("allCaches") private static final List> allCaches = new ArrayList<>(); private ClassLoaderMatcherCacheHolder() {} public static void addCache(Cache cache) { synchronized (allCaches) { allCaches.add(cache); } } public static void invalidateAllCachesForClassLoader(ClassLoader loader) { synchronized (allCaches) { for (Cache cache : allCaches) { cache.remove(loader); } } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy