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