Copilot commented on code in PR #7719:
URL: https://github.com/apache/incubator-seata/pull/7719#discussion_r2451050591


##########
config/seata-config-core/pom.xml:
##########
@@ -43,6 +43,10 @@
             <groupId>org.yaml</groupId>
             <artifactId>snakeyaml</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>

Review Comment:
   The addition of commons-lang3 dependency appears unrelated to the PR's 
stated purpose of replacing synchronization logic with ReentrantLock. This 
dependency addition should either be removed from this PR or explained in the 
PR description.
   ```suggestion
   
   ```



##########
core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemotingClient.java:
##########
@@ -90,7 +92,12 @@ public abstract class AbstractNettyRemotingClient extends 
AbstractNettyRemoting
 
     private final CopyOnWriteArrayList<ChannelEventListener> 
channelEventListeners = new CopyOnWriteArrayList<>();
 
-    protected final Object mergeLock = new Object();
+    // synchronized(mergeLock)
+    // mergeLock.wait()/notify()/notifyAll()
+    // Mixed use will cause race conditions or IllegalMonitorStateException

Review Comment:
   This comment references the old `synchronized(mergeLock)` pattern but should 
be updated to reflect the new ReentrantLock pattern. Consider revising to 
something like: 'Use mergeLock.lock()/unlock() with 
mergeCondition.await()/signalAll() for thread coordination. Do not mix with 
synchronized blocks.'
   ```suggestion
       // Use mergeLock.lock()/unlock() with mergeCondition.await()/signalAll() 
for thread coordination.
       // Do not mix with synchronized blocks or 
Object.wait()/notify()/notifyAll(), as this will cause race conditions or 
IllegalMonitorStateException.
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to