sandeep-mst commented on code in PR #25207:
URL: https://github.com/apache/pulsar/pull/25207#discussion_r2762975381


##########
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:
   Went for a different approach altogether. Not creating a new ArrayList.



-- 
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]

Reply via email to