jonyangx commented on code in PR #3268:
URL: 
https://github.com/apache/incubator-eventmesh/pull/3268#discussion_r1118192886


##########
eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/tcp/common/TcpClient.java:
##########
@@ -176,20 +174,16 @@ protected void send(Package msg) throws Exception {
 
     protected Package io(Package msg, long timeout) throws Exception {
         Object key = RequestContext.key(msg);
-        CountDownLatch latch = new CountDownLatch(1);
-        RequestContext c = RequestContext.context(key, msg, latch);
-        if (!contexts.contains(c)) {
-            contexts.put(key, c);
+        RequestContext context = RequestContext.context(key, msg);
+        if (!contexts.contains(context)) {
+            contexts.put(key, context);
         } else {
             if (log.isInfoEnabled()) {
                 log.info("duplicate key : {}", key);
             }
         }
         send(msg);
-        if (!c.getLatch().await(timeout, TimeUnit.MILLISECONDS)) {
-            throw new TimeoutException("operation timeout, context.key=" + 
c.getKey());
-        }
-        return c.getResponse();
+        return context.getResponse(timeout);

Review Comment:
   @mxsm I think original code is better ,its advantages include currency and 
timeout controller logic.



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