Browse Source

Merge pull request #7276 in CORE/base-third from bugfix/11.0 to feature/x

* commit '97f67e2c7b6a37f08b589db9c7e2b11ea3e939f8':
  REPORT-83447  改下注释
  REPORT-83447  驱动管理mysql自定义连接和druid监控不兼容
feature/x
superman 2 years ago
parent
commit
a5b4c28107
  1. 10
      fine-druid/src/main/java/com/fr/third/alibaba/druid/util/MySqlUtils.java

10
fine-druid/src/main/java/com/fr/third/alibaba/druid/util/MySqlUtils.java

@ -16,6 +16,7 @@
package com.fr.third.alibaba.druid.util;
import com.fr.third.alibaba.druid.DbType;
import com.fr.third.alibaba.druid.proxy.jdbc.ConnectionProxy;
import com.fr.third.alibaba.druid.sql.SQLUtils;
import com.fr.third.alibaba.druid.sql.ast.statement.SQLCreateTableStatement;
@ -403,8 +404,13 @@ public class MySqlUtils {
}
public static long getLastPacketReceivedTimeMs(Connection conn) throws SQLException {
ClassLoader cl = conn.getClass().getClassLoader();
// durid监控若开启,Connection 对象是 ConnectionProxy ,且ConnectionProxy和Connection不一定在同一个类加载器下
ClassLoader cl;
if (conn instanceof ConnectionProxy) {
cl = ((ConnectionProxy) conn).getRawObject().getClass().getClassLoader();
} else {
cl = conn.getClass().getClassLoader();
}
ConnectionClass cc = classLoaderConnectionClassMap.compute(cl, (k, v) -> {
if (v == null || v.class_connectionImpl.getClassLoader() != cl) {
return new ConnectionClass();

Loading…
Cancel
Save