Skip to content

Commit

Permalink
Remove findLoadedClass
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Kent committed Aug 3, 2018
1 parent 0cbef2d commit 50ed54c
Showing 1 changed file with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import datadog.trace.bootstrap.DatadogClassLoader;
import datadog.trace.bootstrap.DatadogClassLoader.BootstrapClassLoaderProxy;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;

Expand Down Expand Up @@ -80,25 +79,6 @@ public static String getInternalName(final String resourceName) {
return resourceName.replaceAll("\\.class\\$", "").replace('.', '/');
}

public static boolean isClassLoaded(final String className, final ClassLoader classLoader) {
Class<?> loadedClass = findLoadedClass(className, classLoader);
return loadedClass != null && loadedClass.getClassLoader() == classLoader;
}

public static Class<?> findLoadedClass(final String className, ClassLoader classLoader) {
if (classLoader == ClassLoaderMatcher.BOOTSTRAP_CLASSLOADER) {
classLoader = ClassLoader.getSystemClassLoader();
}
try {
findLoadedClassMethod.setAccessible(true);
return (Class<?>) findLoadedClassMethod.invoke(classLoader, className);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new IllegalStateException(e);
} finally {
findLoadedClassMethod.setAccessible(false);
}
}

static boolean getConfigEnabled(final String name, final boolean fallback) {
final String property =
System.getProperty(
Expand Down

0 comments on commit 50ed54c

Please sign in to comment.