karsonto commented on code in PR #4696:
URL: https://github.com/apache/eventmesh/pull/4696#discussion_r1439111008


##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/TcpClient.java:
##########
@@ -181,10 +181,12 @@ protected void send(Package msg) throws Exception {
     protected Package io(Package msg, long timeout) throws Exception {
         Object key = RequestContext.key(msg);
         RequestContext context = RequestContext.context(key, msg);
-        if (!contexts.containsValue(context)) {
-            contexts.put(key, context);
-        } else {
-            LogUtils.info(log, "duplicate key : {}", key);
+        synchronized (context) {

Review Comment:
   Really exist the above-mentioned problem , It has been recommitted for 
review. Thank you.



##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/TcpClient.java:
##########
@@ -181,10 +181,12 @@ protected void send(Package msg) throws Exception {
     protected Package io(Package msg, long timeout) throws Exception {
         Object key = RequestContext.key(msg);
         RequestContext context = RequestContext.context(key, msg);
-        if (!contexts.containsValue(context)) {
-            contexts.put(key, context);
-        } else {
-            LogUtils.info(log, "duplicate key : {}", key);
+        synchronized (context) {
+            if (!contexts.containsValue(context)) {
+                contexts.put(key, context);
+            } else {
+                LogUtils.info(log, "duplicate key : {}", key);
+            }

Review Comment:
   Please review again, thanks



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