NIFI-6022 Added try/catch to protect against secondary exception in a primary exception catch clause

NIFI-6022 mods per PR review

NIFI-6022 mods per PR review

This closes #3476.

Signed-off-by: Koji Kawamura <ijokarumawak@apache.org>
This commit is contained in:
slyouts 2019-05-15 15:19:25 -04:00 committed by Koji Kawamura
parent de27ab94b0
commit 097b9c3075
1 changed files with 6 additions and 1 deletions

View File

@ -126,7 +126,12 @@ final class JMSConsumer extends JMSWorker {
// We need to call recover to ensure that in the event of
// abrupt end or exception the current session will stop message
// delivery and restart with the oldest unacknowledged message
session.recover();
try {
session.recover();
} catch (Exception e1) {
// likely the session is closed...need to catch this so that the root cause of failure is propagated
processLog.debug("Failed to recover JMS session while handling initial error. The recover error is: ", e1);
}
throw e;
} finally {
JmsUtils.closeMessageConsumer(msgConsumer);