This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-jms.git
The following commit(s) were added to refs/heads/main by this push: new 7046c7d QPIDJMS-530 Add null check when dealing with consumer remote close 7046c7d is described below commit 7046c7d37c951b07684d3c9bade5e3191c5fc60f Author: Timothy Bish <tabish...@gmail.com> AuthorDate: Mon Mar 29 12:18:48 2021 -0400 QPIDJMS-530 Add null check when dealing with consumer remote close Possible race on concurrent close from local and remote can lead to NPE during remote close handling as consumer might have already removed itself from tracking at the session lvel. --- .../src/main/java/org/apache/qpid/jms/JmsSession.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java index 274d99c..4907d16 100644 --- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java +++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java @@ -341,7 +341,7 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe stop(); for (JmsMessageConsumer consumer : new ArrayList<JmsMessageConsumer>(this.consumers.values())) { - if(consumer.hasMessageListener()) { + if (consumer.hasMessageListener()) { listenerPresent = true; } @@ -425,12 +425,12 @@ public class JmsSession implements AutoCloseable, Session, QueueSession, TopicSe LOG.info("A JMS MessageConsumer has been closed: {}", resource); JmsMessageConsumer consumer = consumers.get(resource.getId()); - if (consumer.hasMessageListener()) { - connection.onAsyncException(JmsExceptionSupport.create(cause)); - } - try { if (consumer != null) { + if (consumer.hasMessageListener()) { + connection.onAsyncException(JmsExceptionSupport.create(cause)); + } + consumer.shutdown(cause); } } catch (Throwable error) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org