heesung-sohn commented on code in PR #25207:
URL: https://github.com/apache/pulsar/pull/25207#discussion_r2762781509


##########
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) {

Review Comment:
   would this work, instead of the snapshot array?
   int pendingMessageCountToFail = pendingMessages.size();
   for(int i =0; i< pendingMessageCountToFail; i++){
    var op = pendingMessages.remove()
     // fail op;
   }
   
   Then, we don't need to pendingMessages.clear(); at the line 2327.



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