From 64357114b64112ab26ee68b4e627ab31d83ce23c Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Thu, 1 Aug 2019 13:39:50 -0400 Subject: [PATCH] NIFI-6517: Ensure that if IOException is thrown from LoadBalanceSession that we properly catch the Exception, mark session as complete, and then re-throw. There was one condition in which this was not occurring. This commit addresses that situation. --- .../client/async/nio/LoadBalanceSession.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/LoadBalanceSession.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/LoadBalanceSession.java index f5c35ebb74bc..c3496b83c234 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/LoadBalanceSession.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/LoadBalanceSession.java @@ -136,14 +136,14 @@ public synchronized boolean communicate() throws IOException { return false; } - // If there's already a data frame prepared for writing, just write to the channel. - if (preparedFrame != null && preparedFrame.hasRemaining()) { - logger.trace("Current Frame is already available. Will continue writing current frame to channel"); - final int bytesWritten = channel.write(preparedFrame); - return bytesWritten > 0; - } - try { + // If there's already a data frame prepared for writing, just write to the channel. + if (preparedFrame != null && preparedFrame.hasRemaining()) { + logger.trace("Current Frame is already available. Will continue writing current frame to channel"); + final int bytesWritten = channel.write(preparedFrame); + return bytesWritten > 0; + } + // Check if the phase is one that needs to receive data and if so, call the appropriate method. switch (phase) { case RECEIVE_SPACE_RESPONSE: