[강운덕] [LUCYSUS-1744] 바이트 코드 변환 부분 추상화.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@531 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2012-08-22 08:55:32 +00:00
parent a5ee994e8a
commit e13abc08b5
7 changed files with 141 additions and 14 deletions
@@ -0,0 +1,40 @@
package com.profiler.interceptor.bci;
import com.profiler.interceptor.Interceptor;
import javassist.CannotCompileException;
import javassist.CtClass;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class JavaAssistClass implements InstrumentClass {
private final Logger logger = Logger.getLogger(this.getClass().getName());
private JavaAssistByteCodeInstrumentor instrumentor;
private CtClass ctClass;
public JavaAssistClass(JavaAssistByteCodeInstrumentor instrumentor, CtClass ctClass) {
this.instrumentor = instrumentor;
this.ctClass = ctClass;
}
@Override
public void addInterceptor(String methodName, String[] args, Interceptor interceptor) {
}
@Override
public byte[] toBytecode() {
try {
return ctClass.toBytecode();
} catch (IOException e) {
logger.log(Level.INFO, "IoException class:" + ctClass.getName() + " " + e.getMessage(), e);
} catch (CannotCompileException e) {
logger.log(Level.INFO, "CannotCompileException class:" + ctClass.getName() + " " + e.getMessage(), e);
}
return null;
}
}