Search in sources :

Example 1 with HierarchyMultipleClassPool

use of com.navercorp.pinpoint.profiler.instrument.classpool.HierarchyMultipleClassPool in project pinpoint by naver.

the class HierarchyMultipleClassPoolTest method testTestClass.

@Test
public void testTestClass() throws Exception {
    NamedClassPool pool = new NamedClassPool("test");
    pool.childFirstLookup = true;
    HierarchyMultipleClassPool multipleClassPool = new HierarchyMultipleClassPool(pool);
    ClassLoader classLoader = new URLClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
    multipleClassPool.getClassPool(classLoader);
    logger.debug("size {}", multipleClassPool.size());
    for (NamedClassPool classPool1 : multipleClassPool.values()) {
        logger.debug("classPool:{} name:{}", classPool1, classPool1.getName());
    }
    Assert.assertEquals(2, multipleClassPool.size());
}
Also used : URLClassLoader(java.net.URLClassLoader) NamedClassPool(com.navercorp.pinpoint.profiler.instrument.classpool.NamedClassPool) HierarchyMultipleClassPool(com.navercorp.pinpoint.profiler.instrument.classpool.HierarchyMultipleClassPool) URLClassLoader(java.net.URLClassLoader) Test(org.junit.Test)

Example 2 with HierarchyMultipleClassPool

use of com.navercorp.pinpoint.profiler.instrument.classpool.HierarchyMultipleClassPool in project pinpoint by naver.

the class HierarchyMultipleClassPoolTest method testGetClassPool.

@Test
public void testGetClassPool() throws Exception {
    NamedClassPool cp = new NamedClassPool("test");
    HierarchyMultipleClassPool multipleClassPool = new HierarchyMultipleClassPool(cp);
    ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
    NamedClassPool classPool = multipleClassPool.getClassPool(systemClassLoader);
    CtClass string = classPool.get("java.lang.String");
    logger.debug("{}", string);
}
Also used : CtClass(javassist.CtClass) NamedClassPool(com.navercorp.pinpoint.profiler.instrument.classpool.NamedClassPool) HierarchyMultipleClassPool(com.navercorp.pinpoint.profiler.instrument.classpool.HierarchyMultipleClassPool) URLClassLoader(java.net.URLClassLoader) Test(org.junit.Test)

Aggregations

HierarchyMultipleClassPool (com.navercorp.pinpoint.profiler.instrument.classpool.HierarchyMultipleClassPool)2 NamedClassPool (com.navercorp.pinpoint.profiler.instrument.classpool.NamedClassPool)2 URLClassLoader (java.net.URLClassLoader)2 Test (org.junit.Test)2 CtClass (javassist.CtClass)1