sijie commented on a change in pull request #3581: Fix thread safety violation 
on ProducerImpl
URL: https://github.com/apache/pulsar/pull/3581#discussion_r256670903
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
 ##########
 @@ -803,12 +806,12 @@ protected boolean 
verifyLocalBufferIsNotCorrupted(OpSendMsg op) {
     }
 
     protected static final class OpSendMsg {
-        MessageImpl<?> msg;
-        List<MessageImpl<?>> msgs;
-        ByteBufPair cmd;
-        SendCallback callback;
-        long sequenceId;
-        long createdAt;
+        volatile MessageImpl<?> msg;
 
 Review comment:
   @lovelle Have you seen any issues regarding these fields? OpSendMsg is a 
per-message structure. I don't expect it to be shared by multiple threads a 
lot. Is it too heavy to convert all fields to `volatile`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to