mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-18 17:26:14 +10:00
[강운덕] [PROFILER-34] loadbalance driver관련 처리 삭제.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@3984 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
-60
@@ -1,60 +0,0 @@
|
||||
package com.nhn.pinpoint.profiler.modifier.db.mysql;
|
||||
|
||||
import com.mysql.jdbc.LoadBalancedMySQLConnection;
|
||||
import com.nhn.pinpoint.bootstrap.Agent;
|
||||
import com.nhn.pinpoint.bootstrap.interceptor.Interceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.ByteCodeInstrumentor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentClass;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentException;
|
||||
import com.nhn.pinpoint.profiler.modifier.AbstractModifier;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.DriverConnectInterceptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class MySQLLoadBalancedMySQLConnectionModifier extends AbstractModifier {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public MySQLLoadBalancedMySQLConnectionModifier(ByteCodeInstrumentor byteCodeInstrumentor, Agent agent) {
|
||||
super(byteCodeInstrumentor, agent);
|
||||
}
|
||||
|
||||
public String getTargetClass() {
|
||||
return "com/mysql/jdbc/LoadBalancedMySQLConnection";
|
||||
}
|
||||
|
||||
public byte[] modify(ClassLoader classLoader, String javassistClassName, ProtectionDomain protectedDomain, byte[] classFileBuffer) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Modifing. {}", javassistClassName);
|
||||
}
|
||||
// 여기는 추상클래스로 빼서
|
||||
this.byteCodeInstrumentor.checkLibrary(classLoader, javassistClassName);
|
||||
try {
|
||||
InstrumentClass mysqlConnection = byteCodeInstrumentor.getClass(javassistClassName);
|
||||
|
||||
|
||||
|
||||
Interceptor createConnection = new DriverConnectInterceptor();
|
||||
String[] params = new String[]{
|
||||
"java.lang.String", "java.util.Properties"
|
||||
};
|
||||
mysqlConnection.addInterceptor("connect", params, createConnection);
|
||||
|
||||
if (this.logger.isInfoEnabled()) {
|
||||
this.logger.info("{} class is converted.", javassistClassName);
|
||||
}
|
||||
|
||||
return mysqlConnection.toBytecode();
|
||||
} catch (InstrumentException e) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user