use of com.jim.framework.rpc.common.RpcInvoker in project jim-framework by jiangmin168168.
the class RpcHystrixCommand method run.
@Override
protected Object run() {
RpcRequest request = new RpcRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setClassName(method.getDeclaringClass().getName());
request.setMethodName(method.getName());
request.setParameterTypes(method.getParameterTypes());
request.setParameters(this.params);
if (this.rpcReference != null) {
request.setMaxExecutesCount(this.rpcReference.maxExecutesCount());
}
request.setContextParameters(RpcContext.getContext().getContextParameters());
RpcClientInvoker invoker = RpcClientInvokerManager.getInstance(this.referenceConfig).getInvoker();
invoker.setRpcRequest(request);
RpcInvoker rpcInvoker = invoker.buildInvokerChain(invoker);
ResponseFuture response = (ResponseFuture) rpcInvoker.invoke(invoker.buildRpcInvocation(request));
if (this.rpcReference.isSync()) {
return response.get();
} else {
RpcContext.getContext().setResponseFuture(response);
return null;
}
}
Aggregations