同步获取响应数据

This commit is contained in:
Guoqs
2024-08-01 16:24:52 +08:00
parent 201137bb9f
commit 901310f061
9 changed files with 61 additions and 307 deletions

View File

@@ -1,5 +1,7 @@
package com.jsowell.netty.rpc;
import com.jsowell.pile.rpc.RpcUtil;
import java.util.concurrent.TimeUnit;
public class TestRpcClient {
@@ -13,9 +15,9 @@ public class TestRpcClient {
rpcRequest.setParam("参数1");
try {
System.out.println("thread1发送请求");
RpcResponse rpcResponse = RpcUtil.send(rpcRequest, 5, TimeUnit.SECONDS);
System.out.println("thread1处理结果" + rpcResponse);
// System.out.println("thread1发送请求");
// RpcResponse rpcResponse = RpcUtil.send(rpcRequest, 5, TimeUnit.SECONDS);
// System.out.println("thread1处理结果" + rpcResponse);
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -29,9 +31,9 @@ public class TestRpcClient {
rpcRequest2.setParam("参数2");
try {
System.out.println("thread2发送请求");
RpcResponse rpcResponse = RpcUtil.send(rpcRequest2, 2, TimeUnit.SECONDS);
System.out.println("thread2处理结果" + rpcResponse);
// System.out.println("thread2发送请求");
// RpcResponse rpcResponse = RpcUtil.send(rpcRequest2, 2, TimeUnit.SECONDS);
// System.out.println("thread2处理结果" + rpcResponse);
} catch (Exception e) {
throw new RuntimeException(e);
}