michaeljmarshall opened a new pull request #12259: URL: https://github.com/apache/pulsar/pull/12259
### Motivation When calling `ProducerImpl#closeAsync`, the current cleanup relies on `clearPendingMessagesWhenClose`. This method does not fail any remaining messages in the `batchMessageContainer`. After inspecting the `failPendingMessages` method, it looks like it would be better to call this within the `clearPendingMessagesWhenClose` method. It also has more robust handling of failing the messages contained in the `pendingMessages` queue. ### Modifications * Update the implementation of `clearPendingMessagesWhenClose` to rely on `failPendingMessages`. * Move already thread safe method calls, like `setState` outside of the `synchronized` block ### Verifying this change I added a test that will pass regardless of the outcome of the current mailing list thread discussing whether "close implies flush". There is also already a test that ensures that any outstanding pending messages are failed. Together, these tests ensure correct behavior. ### Does this pull request potentially affect one of the following parts: This is not a breaking change. ### Documentation There is no need to update the docs for this change. -- 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]
