This is an automated email from the ASF dual-hosted git repository.

lizhanhui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new acf4d8b2b [ISSUE #5051]Remove GroupCommitService#run synchronized code 
chunk (#5052)
acf4d8b2b is described below

commit acf4d8b2b88576ea47140992c901b9ea6fe4988b
Author: mxsm <[email protected]>
AuthorDate: Fri Sep 23 21:37:47 2022 +0800

    [ISSUE #5051]Remove GroupCommitService#run synchronized code chunk (#5052)
    
    * [ISSUE #5051]Remove GroupCommitService#run synchronized code chunk
    
    * Remove unnecessary synchronization
    
    Co-authored-by: lizhanhui <[email protected]>
---
 store/src/main/java/org/apache/rocketmq/store/CommitLog.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/store/src/main/java/org/apache/rocketmq/store/CommitLog.java 
b/store/src/main/java/org/apache/rocketmq/store/CommitLog.java
index 9b9b7274b..d584167b9 100644
--- a/store/src/main/java/org/apache/rocketmq/store/CommitLog.java
+++ b/store/src/main/java/org/apache/rocketmq/store/CommitLog.java
@@ -1448,7 +1448,7 @@ public class CommitLog implements Swappable {
         private volatile LinkedList<GroupCommitRequest> requestsRead = new 
LinkedList<GroupCommitRequest>();
         private final PutMessageSpinLock lock = new PutMessageSpinLock();
 
-        public synchronized void putRequest(final GroupCommitRequest request) {
+        public void putRequest(final GroupCommitRequest request) {
             lock.lock();
             try {
                 this.requestsWrite.add(request);
@@ -1496,6 +1496,7 @@ public class CommitLog implements Swappable {
             }
         }
 
+        @Override
         public void run() {
             CommitLog.log.info(this.getServiceName() + " service started");
 
@@ -1516,10 +1517,7 @@ public class CommitLog implements Swappable {
                 CommitLog.log.warn("GroupCommitService Exception, ", e);
             }
 
-            synchronized (this) {
-                this.swapRequests();
-            }
-
+            this.swapRequests();
             this.doCommit();
 
             CommitLog.log.info(this.getServiceName() + " service end");

Reply via email to