Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARTEMIS-5155 Send of AMQP large messages should close the LargeMessageReader before proceeding with the message delivery #5346

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This null assignment should remain in a finally block as it ensures that the reader is always nulled when onMessageComplete gets called.


actualDelivery(message, delivery, deliveryAnnotations, receiver, tx);
}

@Override
Expand Down