Commit 86a64ec8 by huangfusuper

修改RPC的超时时间

parent b0e75229
...@@ -211,10 +211,12 @@ public class RpcReferenceBean { ...@@ -211,10 +211,12 @@ public class RpcReferenceBean {
// future-response set // future-response set
RpcFutureResponse futureResponse = new RpcFutureResponse(invokerFactory, rpcRequest, null); RpcFutureResponse futureResponse = new RpcFutureResponse(invokerFactory, rpcRequest, null);
try { try {
//TODO 改方法需要添加ip测试功能项
// do invoke // do invoke
client.asyncSend(finalAddress, rpcRequest); client.asyncSend(finalAddress, rpcRequest);
// future get // future get
logger.debug(">>>>>>>>>>>>数据:{},请求:{},的超时时间为:{}",rpcRequest,rpcRequest.getRequestId(),timeout);
RpcResponse rpcResponse = futureResponse.get(timeout, TimeUnit.MILLISECONDS); RpcResponse rpcResponse = futureResponse.get(timeout, TimeUnit.MILLISECONDS);
if (rpcResponse.getErrorMsg() != null) { if (rpcResponse.getErrorMsg() != null) {
throw new RpcException(rpcResponse.getErrorMsg()); throw new RpcException(rpcResponse.getErrorMsg());
...@@ -231,23 +233,23 @@ public class RpcReferenceBean { ...@@ -231,23 +233,23 @@ public class RpcReferenceBean {
} else if (CallType.FUTURE == callType) { } else if (CallType.FUTURE == callType) {
// future-response set // future-response set
RpcFutureResponse futureResponse = new RpcFutureResponse(invokerFactory, rpcRequest, null); RpcFutureResponse futureResponse = new RpcFutureResponse(invokerFactory, rpcRequest, null);
try { try {
// invoke future set // invoke future set
RpcInvokeFuture invokeFuture = new RpcInvokeFuture(futureResponse); RpcInvokeFuture invokeFuture = new RpcInvokeFuture(futureResponse);
RpcInvokeFuture.setFuture(invokeFuture); RpcInvokeFuture.setFuture(invokeFuture);
// do invoke // do invoke
client.asyncSend(finalAddress, rpcRequest); client.asyncSend(finalAddress, rpcRequest);
return null; return null;
} catch (Exception e) { } catch (Exception e) {
logger.info(">>>>>>>>>>> myth-rpc, invoke error, address:{}, RpcRequest{}", finalAddress, rpcRequest); logger.info(">>>>>>>>>>> myth-rpc, invoke error, address:{}, RpcRequest{}", finalAddress, rpcRequest);
// future-response remove // future-response remove
futureResponse.removeInvokerFuture(); futureResponse.removeInvokerFuture();
throw (e instanceof RpcException)?e:new RpcException(e); throw (e instanceof RpcException)?e:new RpcException(e);
} }
} else if (CallType.CALLBACK == callType) { } else if (CallType.CALLBACK == callType) {
...@@ -276,9 +278,9 @@ return null; ...@@ -276,9 +278,9 @@ return null;
return null; return null;
} else if (CallType.ONEWAY == callType) { } else if (CallType.ONEWAY == callType) {
client.asyncSend(finalAddress, rpcRequest); client.asyncSend(finalAddress, rpcRequest);
return null; return null;
} else { } else {
throw new RpcException("myth-rpc callType["+ callType +"] invalid"); throw new RpcException("myth-rpc callType["+ callType +"] invalid");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment