Dubbo3 RpcContext中的3个RpcContextAttachment和1个RpcServiceContext

dubbo3 在RpcContext中RpcContextAttachment和RpcServiceContext的生命周期

Context Remove Point Describe
SERVER_LOCAL ContextFilter.onResponse
ContextFilter.onError
ConsumerContextFilter.invoke
该变量的生命周期只会作用在provider侧,但是一时provider转换为consumer角色时,就会将该变量清除
CLIENT_ATTACHMENT ContextFilter.onResponse
ContextFilter.onError
ConsumerContextFilter.onResponse
ConsumerContextFilter.onError
在Provider侧和Consumer侧的Filter的onResponse和onError方法中都会被清除
SERVICE_CONTEXT ContextFilter.onResponse
ContextFilter.onError
ConsumerContextFilter.onResponse
ConsumerContextFilter.onError
在Provider侧和Consumer侧的Filter的onResponse和onError方法中都会被清除
SERVER_ATTACHMENT ContextFilter.onResponse
ContextFilter.onError
在Provider侧的ContextFilter处理响应或者处理异常的方法中清除该ThreadLocal;
同样在ContextFilter.invoke 方法也事先设置了条件(context.clearAfterEachInvoke(false))该变量在除该类外不会随意被清除

猜你喜欢

转载自blog.csdn.net/Mr_rain/article/details/125858548