yuluo-yx commented on code in PR #2333:
URL: https://github.com/apache/hertzbeat/pull/2333#discussion_r1687351047
##########
collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/JdbcConnect.java:
##########
@@ -39,8 +40,23 @@ public void closeConnection() throws Exception {
}
}
+ @Override
+ public void check() throws SQLException {
+
+ if (connection.isClosed()) {
+ throw new SQLException("Connection is closed");
+ }
+ }
+
@Override
public Connection getConnection() {
+
+ try {
+ this.check();
+ }
+ catch (SQLException e) {
+ throw new RuntimeException(e.getMessage());
Review Comment:
Returning null here and printing the logs would probably block the @tomsun28
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]