use of com.navercorp.pinpoint.profiler.instrument.classpool.IsolateMultipleClassPool in project pinpoint by naver.
the class IsolateMultipleClassPoolTest method testPoolSize.
@Test
public void testPoolSize() throws Exception {
IsolateMultipleClassPool pool = new IsolateMultipleClassPool();
NamedClassPool systemPool = pool.getClassPool(systemClassLoader);
Assert.assertEquals(0, pool.size());
pool.getClassPool(null);
Assert.assertEquals(0, pool.size());
Assert.assertSame(systemPool, pool.getClassPool(systemClassLoader));
NamedClassPool child1Pool = pool.getClassPool(child1);
Assert.assertEquals(1, pool.size());
NamedClassPool child1Pool_recheck = pool.getClassPool(child1);
Assert.assertEquals(1, pool.size());
Assert.assertSame(child1Pool, child1Pool_recheck);
Assert.assertNotSame(systemPool, child1Pool);
NamedClassPool classPool2 = pool.getClassPool(child2);
Assert.assertEquals(2, pool.size());
pool.getClassPool(child2);
Assert.assertEquals(2, pool.size());
Assert.assertNotSame(systemPool, classPool2);
}
use of com.navercorp.pinpoint.profiler.instrument.classpool.IsolateMultipleClassPool in project pinpoint by naver.
the class IsolateMultipleClassPoolTest method testGetClass_childLookupFirst.
@Test
public void testGetClass_childLookupFirst() throws Exception {
IsolateMultipleClassPool pool = new IsolateMultipleClassPool(false, IsolateMultipleClassPool.EMPTY_EVENT_LISTENER, null);
NamedClassPool systemPool = pool.getClassPool(systemClassLoader);
CtClass systemLogger = systemPool.get(TEST_CLASS);
NamedClassPool rootPool = pool.getClassPool(root);
CtClass rootLogger = rootPool.get(TEST_CLASS);
Assert.assertSame(systemLogger, rootLogger);
NamedClassPool childPool = pool.getClassPool(child1);
CtClass childLogger = childPool.get(TEST_CLASS);
Assert.assertSame(systemLogger, childLogger);
NamedClassPool childPool2 = pool.getClassPool(child2);
CtClass child2Logger = childPool2.get(TEST_CLASS);
Assert.assertSame(systemLogger, child2Logger);
}
use of com.navercorp.pinpoint.profiler.instrument.classpool.IsolateMultipleClassPool in project pinpoint by naver.
the class IsolateMultipleClassPoolTest method testGetClass.
@Test
public void testGetClass() throws Exception {
IsolateMultipleClassPool pool = new IsolateMultipleClassPool();
NamedClassPool systemPool = pool.getClassPool(systemClassLoader);
String classname = "java.lang.String";
CtClass systemString = systemPool.get(classname);
NamedClassPool childPool = pool.getClassPool(child1);
CtClass childPoolString = childPool.get("java.lang.String");
Assert.assertNotSame(systemString, childPoolString);
Assert.assertNotSame(systemString.getClassPool(), childPoolString.getClassPool());
CtClass testClass = childPool.get(this.getClass().getName());
Assert.assertNotSame(systemString.getClassPool(), testClass.getClassPool());
NamedClassPool childPool2 = pool.getClassPool(child2);
CtClass testClass2 = childPool2.get(this.getClass().getName());
Assert.assertNotSame(systemString.getClassPool(), testClass2.getClassPool());
CtClass testCtClass = childPool2.get(TEST_CLASS);
logger.debug("className:{}", Arrays.toString(testCtClass.getConstructors()));
}
Aggregations