You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2018/01/05 21:00:51 UTC

nifi git commit: NIFI-4742: Clean up CaptureChangeMySQL connection resources on connect failure. This closes #2379

Repository: nifi
Updated Branches:
  refs/heads/master 81d3f6f32 -> e43f07e31


NIFI-4742: Clean up CaptureChangeMySQL connection resources on connect failure. This closes #2379


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/e43f07e3
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/e43f07e3
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/e43f07e3

Branch: refs/heads/master
Commit: e43f07e31db34fbdaebc2a57ab3548cfaf4322da
Parents: 81d3f6f
Author: Matthew Burgess <ma...@apache.org>
Authored: Fri Jan 5 15:08:20 2018 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Fri Jan 5 16:00:13 2018 -0500

----------------------------------------------------------------------
 .../org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java  | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/e43f07e3/nifi-nar-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java b/nifi-nar-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java
index 5ee51fd..d15ad6b 100644
--- a/nifi-nar-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java
+++ b/nifi-nar-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java
@@ -704,6 +704,7 @@ public class CaptureChangeMySQL extends AbstractSessionFactoryProcessor {
             }
         }
         if (!binlogClient.isConnected()) {
+            binlogClient.disconnect();
             binlogClient = null;
             throw new IOException("Could not connect binlog client to any of the specified hosts due to: " + lastConnectException.getMessage(), lastConnectException);
         }
@@ -712,6 +713,8 @@ public class CaptureChangeMySQL extends AbstractSessionFactoryProcessor {
             try {
                 jdbcConnection = getJdbcConnection(driverLocation, driverName, connectedHost, username, password, null);
             } catch (InitializationException | SQLException e) {
+                binlogClient.disconnect();
+                binlogClient = null;
                 throw new IOException("Error creating binlog enrichment JDBC connection to any of the specified hosts", e);
             }
         }