yangyi438 commented on issue #1101: Improve understandable  of 
GroupCommitService's locks
URL: https://github.com/apache/rocketmq/issues/1101#issuecomment-501260810
 
 
     public synchronized void putRequest(final GroupCommitRequest request) {
            1   synchronized (**this.requestsWrite**) {
             2     **this.requestsWrite**.add(request);
               }
               if (hasNotified.compareAndSet(false, true)) {
                   waitPoint.countDown(); // notify
               }
           }
   
   Second line of code When calling  #add of Arraylist
   seem volatile read again may not hold the lock of  the **this.requestsWrite**
   because org.apache.rocketmq.store.CommitLog.GroupCommitService#swapRequests 
may Execute concurrently In other threads
   then 
   **this.requestsWrite** is **this.requestsRead** actually
   
   
   
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to