[유치수] [NOBTS] add BLOC classpath

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@860 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Chisu Yu
2012-11-13 10:02:35 +00:00
parent bd65b0d937
commit a26bd8cd98
+20 -11
View File
@@ -47,19 +47,28 @@ public class TomcatProfiler implements ClassFileTransformer {
String[] paths = getTomcatlibPath();
this.byteCodeInstrumentor = new JavaAssistByteCodeInstrumentor(paths);
this.modifierRepository = createModifierRegistry(byteCodeInstrumentor);
}
private String[] getTomcatlibPath() {
String catalinaHome = System.getProperty("catalina.home");
if (catalinaHome == null) {
return null;
}
if (logger.isLoggable(Level.INFO)) {
logger.info("CATALINA_HOME=" + catalinaHome);
}
return new String[] {catalinaHome + "/lib/servlet-api.jar", catalinaHome + "/lib/catalina.jar"};
}
private String[] getTomcatlibPath() {
String catalinaHome = System.getProperty("catalina.home");
if (catalinaHome == null) {
return null;
}
if (logger.isLoggable(Level.INFO)) {
logger.info("CATALINA_HOME=" + catalinaHome);
}
// TODO This is draft. How can we support both Tomcat and BLOC without this configuration?
String type = System.getProperty("hippo.servertype", "tomcat");
if (type.equals("bloc")) {
return new String[] { catalinaHome + "/server/lib/catalina.jar", catalinaHome + "/common/lib/servlet-api.jar" };
} else {
return new String[] { catalinaHome + "/lib/servlet-api.jar", catalinaHome + "/lib/catalina.jar" };
}
}
private ModifierRegistry createModifierRegistry(ByteCodeInstrumentor byteCodeInstrumentor) {
DefaultModifierRegistry modifierRepository = new DefaultModifierRegistry(byteCodeInstrumentor, profilerConfig);