gemmellr commented on code in PR #4932:
URL: https://github.com/apache/activemq-artemis/pull/4932#discussion_r1606489945
##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java:
##########
@@ -170,16 +170,26 @@ private void resume() {
}
private void tryDelivering() {
+
+ final Delivery localDelivery = delivery;
+ final MessageReference localReference = reference;
+ final LargeBodyReader localBodyReader = largeBodyReader;
+
+ if (localDelivery == null || localReference == null || localBodyReader
== null) {
+ logger.debug("Write got closed before tryDelivering was called");
+ return;
+ }
Review Comment:
The close method is only safe to call on the connection thread, which is
where it appears to be being called. Are you seeing otherwise? If not there is
no benefit in introducing the 3 additional variables and complicating the code
with a huge if statement (might even mislead folks into thinking there is some
safety there isnt). Should be no need for synchronization as the writing code
is not called concurrently. It would seem its simply running from a previous
scheduling, but no longer needs to. If so that can be addressed by checking
'closed' at the start of the scheduled task if it was closed already before
proceeding.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]