首页 > 编程知识 正文

dubbo源码解读,深入理解dubbo与实战 pdf

时间:2023-05-03 18:04:28 阅读:14038 作者:2177

publicresultdoinvoke (invocation invocation,final List invokers,LoadBalance loadbalance ) throwsRpcException {

列表副本=Invokers;

checkinvokers(copyinvokers,invocation; //默认情况下重试两次

int len=getUrl ().getmethodparameter (invocation.get method name ),Constants.RETRIES_KEY,constants.default ) if(len=0) {

len=1;

}//恢复loop。

列表invoked=new ArrayList (copyinvokers.size ); //invoked invokers。

设置提供程序=new hashset (len ); for(intI=0; i len; I )//reselectbeforeretrytoavoidachangeofcandidate ` invokers `./note 3360 if ` invokers ` changed,then ` invoked `/notod

if(I0 ) {

checkWhetherDestroyed (;

副本=列表(invocation; //check again

checkinvokers(copyinvokers,invocation;

//选择要重试的Invoker

invoker invoker=select (加载平衡,邀请,复制,邀请);

invoked.add(invoker;

result result=invoker.invoke (invocation ); if(le!=null logger.isWarnEnabled (

logger.warn (althoughretrythemethod ' invocation.get method name ) (in the service ' getInterface ) (.getName ) )。 ' wassuccessfulbytheprovider ' invoker.geturl ().getAddress ) )、buttherehavebeenfailedproviders ' (providers ) ' copyinvokers.size ) ) ) from the registry ' dir ry.get address (' on the consumer ' net utils.get localhost ) ' usingthedubbbbed

}返回结果;

} catch (rpcexceptione (if ) e.isbiz ) ) ) { //biz exception。

真的吗

}

le=e;

} catch (可移植e ) {

le=newrpcexception (e.getmessage ),e );

}finally{

providers.add(invoker.geturl ().get地址);

}

}thrownewRPCexception(le!=null? le.getcode(:' Failed to invoke the method '

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。