tabish121 commented on code in PR #5346: URL: https://github.com/apache/activemq-artemis/pull/5346#discussion_r1848637004
########## artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonAbstractReceiver.java: ########## @@ -345,25 +345,23 @@ public void onMessageComplete(Delivery delivery, Message message, DeliveryAnnotations deliveryAnnotations) { connection.requireInHandler(); - try { - receiver.advance(); - - Transaction tx = null; - if (delivery.getRemoteState() instanceof TransactionalState) { - TransactionalState txState = (TransactionalState) delivery.getRemoteState(); - try { - tx = this.sessionSPI.getTransaction(txState.getTxnId(), false); - } catch (Exception e) { - this.onExceptionWhileReading(e); - } - } + receiver.advance(); - actualDelivery(message, delivery, deliveryAnnotations, receiver, tx); - } finally { - // reader is complete, we give it up now - this.messageReader.close(); - this.messageReader = null; + Transaction tx = null; + if (delivery.getRemoteState() instanceof TransactionalState) { + TransactionalState txState = (TransactionalState) delivery.getRemoteState(); + try { + tx = this.sessionSPI.getTransaction(txState.getTxnId(), false); + } catch (Exception e) { + this.onExceptionWhileReading(e); + } } + + // messageReader.close should be called before the delivery, to signal the reader is complete. + this.messageReader.close(); + this.messageReader = null; Review Comment: This null assignment should remain in a finally block as it ensures that the reader is always nulled when onMessageComplete gets called. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact