sandeep-mst commented on code in PR #25207:
URL: https://github.com/apache/pulsar/pull/25207#discussion_r2760602728
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:
##########
@@ -2298,11 +2304,16 @@ public void run(Timeout timeout) throws Exception {
* This fails and clears the pending messages with the given exception.
This method should be called from within the
* ProducerImpl object mutex.
*/
- private synchronized void failPendingMessages(ClientCnx cnx,
PulsarClientException ex) {
+ @VisibleForTesting
+ synchronized void failPendingMessages(ClientCnx cnx, PulsarClientException
ex) {
if (cnx == null) {
final AtomicInteger releaseCount = new AtomicInteger();
final boolean batchMessagingEnabled = isBatchMessagingEnabled();
- pendingMessages.forEach(op -> {
+ final ArrayList<OpSendMsg> failingMessages = new
ArrayList<>(pendingMessages.size());
Review Comment:
At this point, the pending messages should consist only the timed out
messages from the producer timeout config. So, it relatively will be low but it
makes sense to size it down. Will update the code.
--
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]