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 '
}