Code Review BAEL-4302
This commit is contained in:
parent
b2a0fcd76b
commit
c5c128033d
|
@ -1,6 +0,0 @@
|
|||
package com.baeldung.loadedclasslisting;
|
||||
|
||||
public enum ClassLoaderType {
|
||||
|
||||
SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.baeldung.loadedclasslisting;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.baeldung.loadedclasslisting.ListLoadedClassesAgent.ClassLoaderType;
|
||||
import com.baeldung.loadedclasslisting.customLoader.ClassLoaderInfo;
|
||||
import com.baeldung.loadedclasslisting.customLoader.CustomClassLoader;
|
||||
|
||||
|
@ -11,13 +12,9 @@ public class Launcher {
|
|||
private static ClassLoader customClassLoader;
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
printClassesLoadedBy(ClassLoaderType.BOOTSTRAP);
|
||||
|
||||
printClassesLoadedBy(ClassLoaderType.SYSTEM);
|
||||
|
||||
printClassesLoadedBy(ClassLoaderType.EXTENSION);
|
||||
|
||||
printClassesLoadedBy(ClassLoaderType.CUSTOM);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,10 @@ import java.lang.instrument.Instrumentation;
|
|||
|
||||
public class ListLoadedClassesAgent {
|
||||
|
||||
public enum ClassLoaderType {
|
||||
SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM , PLATFORM
|
||||
}
|
||||
|
||||
private static Instrumentation instrumentation;
|
||||
|
||||
public static void premain(String agentArgs, Instrumentation instrumentation) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.ArrayList;
|
|||
public class ClassLoaderInfo {
|
||||
|
||||
public void printClassLoaders() throws ClassNotFoundException {
|
||||
|
||||
System.out.println("Classloader of this class:" + ClassLoaderInfo.class.getClassLoader());
|
||||
System.out.println("Classloader of ArrayList:" + ArrayList.class.getClassLoader());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue