lhotari commented on a change in pull request #11884:
URL: https://github.com/apache/pulsar/pull/11884#discussion_r712725919



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
##########
@@ -1291,6 +1289,50 @@ protected OpSendMsg newObject(Handle<OpSendMsg> handle) {
         };
     }
 
+    /**
+     * Queue implementation that is used as the pending messages queue.
+     *
+     * This implementation postpones adding of new OpSendMsg entries that 
happen
+     * while the forEach call is in progress. This is needed for preventing
+     * ConcurrentModificationExceptions that would occur when the forEach 
action
+     * calls the add method via a callback in user code.
+     *
+     * This queue is not thread safe.
+     */
+    protected static class OpSendMsgQueue extends ArrayDeque<OpSendMsg> {

Review comment:
       makes sense. I made the change to delegate to ArrayDeque instead of 
inheriting the class.




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