rionmonster commented on code in PR #235:
URL: 
https://github.com/apache/flink-connector-jdbc/pull/235#discussion_r4065366333


##########
flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/JdbcSourceSplitReader.java:
##########
@@ -222,9 +222,9 @@ public void wakeUp() {}
     @Override
     public void close() throws Exception {
         closeResultSetAndStatement();
-        if (connection != null && !connection.isClosed()) {
-            connection.close();
-        }
+        // The provider is this reader's own copy, so closing it here also 
runs the teardown of a

Review Comment:
   Couldn't we cover _both_ of these cases (e.g. handling the connection 
provider _and_ explicitly closing an open connection)? I'd imagine if we wrap 
the `closeResultSetAndStatement()` and the previous connection closure inside 
of a `try` and handle the provider closure in a `finally` it'd ensure 
everything is closed properly, even in cases of exceptions?



-- 
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]

Reply via email to