在dubbo的provider和consumer的配置文件中,如果都配置了timeout的超时时间,dubbo默认以consumer中配置的时间为准。
provider.xml的配置:
<dubbo:service timeout="4000" retries="0" interface="com.dingding.tms.bms.service.BillingZfbCodOrderService" ref="billingZfbCodOrderService" registry="globalRegistry"/>
conusmer中的配置:
<dubbo:reference id="billingInterService" interface="com.dingding.tms.bms.service.BillingInterService" protocol="dubbo" check="false" registry="globalRegistry" timeout="3000"/>
这个service在调用时的超时时间就是3秒。
另外,
1,consumer会在超过3秒时得到一个调用超时的异常。
2,provider中代码的执行不会因为超时而中断,在执行完毕后,会得到一个dubbo的警告。