|
|
|
@ -386,13 +386,15 @@ public class MySqlUtils {
|
|
|
|
|
|
|
|
|
|
public static long getLastPacketReceivedTimeMs(Connection conn) throws SQLException { |
|
|
|
|
if (!class_connectionImpl_Error) { |
|
|
|
|
if (conn == null) { |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
class_connectionImpl = Utils.loadClass("com.mysql.jdbc.MySQLConnection"); |
|
|
|
|
if (class_connectionImpl == null) { |
|
|
|
|
class_connectionImpl = Utils.loadClass("com.mysql.cj.MysqlConnection"); |
|
|
|
|
if (class_connectionImpl != null) { |
|
|
|
|
mysqlJdbcVersion6 = true; |
|
|
|
|
} |
|
|
|
|
//REPORT-66916 这里之前获取到的是lib下的mysql5实现,而不是自定义mysql8驱动的实现
|
|
|
|
|
String className = conn.getClass().getName(); |
|
|
|
|
class_connectionImpl = Utils.loadClass(className); |
|
|
|
|
if (className.equals("com.mysql.cj.MysqlConnection")) { |
|
|
|
|
mysqlJdbcVersion6 = true; |
|
|
|
|
} |
|
|
|
|
} catch (Throwable error) { |
|
|
|
|
class_connectionImpl_Error = true; |
|
|
|
@ -431,7 +433,7 @@ public class MySqlUtils {
|
|
|
|
|
|
|
|
|
|
return System.currentTimeMillis() |
|
|
|
|
- ((Long) |
|
|
|
|
getIdleFor.invoke(connImpl)) |
|
|
|
|
getIdleFor.invoke(connImpl)) |
|
|
|
|
.longValue(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
throw new SQLException("getIdleFor error", e); |
|
|
|
|