You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "jonyangx (via GitHub)" <gi...@apache.org> on 2023/02/26 02:41:13 UTC

[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #3268: [ISSUE #3267] Refactor RequestContext

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


##########
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:
   Where execute supplyAsync with CompletableFuture?



-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org