|
|
@ -386,15 +386,14 @@ public class MySqlUtils { |
|
|
|
|
|
|
|
|
|
|
|
public static long getLastPacketReceivedTimeMs(Connection conn) throws SQLException { |
|
|
|
public static long getLastPacketReceivedTimeMs(Connection conn) throws SQLException { |
|
|
|
if (!class_connectionImpl_Error) { |
|
|
|
if (!class_connectionImpl_Error) { |
|
|
|
if (conn == null) { |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
//REPORT-66916 这里之前获取到的是lib下的mysql5实现,而不是自定义mysql8驱动的实现
|
|
|
|
mysqlJdbcVersion6 = false; |
|
|
|
String className = conn.getClass().getName(); |
|
|
|
class_connectionImpl = Utils.loadClass("com.mysql.jdbc.MySQLConnection"); |
|
|
|
class_connectionImpl = Utils.loadClass(className); |
|
|
|
if (class_connectionImpl == null || class_connectionImpl.getClassLoader() != conn.getClass().getClassLoader()) { |
|
|
|
if (className.equals("com.mysql.cj.MysqlConnection")) { |
|
|
|
class_connectionImpl = Utils.loadClass("com.mysql.cj.MysqlConnection"); |
|
|
|
mysqlJdbcVersion6 = true; |
|
|
|
if (class_connectionImpl != null) { |
|
|
|
|
|
|
|
mysqlJdbcVersion6 = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Throwable error) { |
|
|
|
} catch (Throwable error) { |
|
|
|
class_connectionImpl_Error = true; |
|
|
|
class_connectionImpl_Error = true; |
|
|
@ -412,7 +411,7 @@ public class MySqlUtils { |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (getIdleFor == null && !getIdleForError) { |
|
|
|
if (!getIdleForError) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
getIdleFor = classJdbc.getMethod("getIdleFor"); |
|
|
|
getIdleFor = classJdbc.getMethod("getIdleFor"); |
|
|
|
getIdleFor.setAccessible(true); |
|
|
|
getIdleFor.setAccessible(true); |
|
|
|