(1) 服务消费方
dubbo 获取application和ip 打印日志,以便排查问题.. 让对方有针对的去具体某个机器上去排查.
xxxService.xxx();
boolean
isConsumerSide = RpcContext.getContext().isConsumerSide();
String
serverIP = RpcContext.getContext().getRemoteHost();
String
application = RpcContext.getContext().getUrl().getParameter( "application" );
yyyService.yyy();
|
(2) 服务提供方
public
class
XxxServiceImpl implements
XxxService {
public
void
xxx() {
boolean
isProviderSide = RpcContext.getContext().isProviderSide();
String
clientIP = RpcContext.getContext().getRemoteHost();
String
application = RpcContext.getContext().getUrl().getParameter( "application" );
yyyService.yyy();
boolean
isProviderSide = RpcContext.getContext().isProviderSide();
}
}
|