You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2015/04/07 19:00:12 UTC

[2/4] incubator-nifi git commit: NIFI-490: If IO error when creating Site-to-Site transaction, cleanup connection

NIFI-490: If IO error when creating Site-to-Site transaction, cleanup connection


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

Branch: refs/heads/develop
Commit: a7862a19ba56f4ce8350d34b38d7d4edc6002a66
Parents: 5098693
Author: Mark Payne <ma...@hotmail.com>
Authored: Tue Apr 7 12:36:35 2015 -0400
Committer: Mark Payne <ma...@hotmail.com>
Committed: Tue Apr 7 12:36:35 2015 -0400

----------------------------------------------------------------------
 .../org/apache/nifi/remote/client/socket/SocketClient.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a7862a19/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/SocketClient.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/SocketClient.java b/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/SocketClient.java
index bd9319f..ed54ccb 100644
--- a/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/SocketClient.java
+++ b/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/SocketClient.java
@@ -130,8 +130,14 @@ public class SocketClient implements SiteToSiteClient {
 		    return null;
 		}
 		
-		final Transaction transaction = connectionState.getSocketClientProtocol().startTransaction(
+		final Transaction transaction;
+		try {
+			transaction = connectionState.getSocketClientProtocol().startTransaction(
 				connectionState.getPeer(), connectionState.getCodec(), direction);
+		} catch (final Throwable t) {
+			pool.terminate(connectionState);
+			throw t;
+		}
 		
 		// Wrap the transaction in a new one that will return the EndpointConnectionState back to the pool whenever
 		// the transaction is either completed or canceled.