apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.34k stars 26.4k forks source link

async异步调用传递性问题已被解决了? #379

Closed summer9989 closed 7 years ago

summer9989 commented 7 years ago

使用dubbo前就看资料说dubbo的异步调用是有传递性的 cosumer ->service A ->service B 这种场景 网上说: 若cosumer async=true去调 serviceA,确实是异步调用.serviceA并未在xml配置async .那么serviceA调用serviceB会变成async=true异步的,导致返回值为null

但是我反复试验: 结果是cosumer 调 serviceA 是异步,但是serviceA 调 serviceB 是同步 . 我断点观察了源码 AbstractInvoker#134行附近 ,并未呈现出传递性.

我的版本是2.5.3 .所以想问是dubbo在某个版本后修复了这个问题么?

wuwen5 commented 7 years ago

RpcContext的实现不支持跨线程的,你可以通过filter扩展,使用阿里开源的 transmittable-thread-local组件来完成,还可以支持线程池的值传递。

oldratlee commented 7 years ago

这个场景更多说明 参见 transmittable-thread-local:需求场景-分布式跟踪系统

PS: @wuwen5 多谢推荐

adonis2014 commented 7 years ago

async异步调用传递性问题,这个问题怎么解决?@wuwen5