This is an automated email from the ASF dual-hosted git repository. hyunkun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push: new b70b3ea Add remoteApplicationName in RpcContext (#3816) b70b3ea is described below commit b70b3eac9ec3323b64ac9596982a09affc01989d Author: yizhenqiang <manzhiz...@163.com> AuthorDate: Wed Apr 10 11:18:33 2019 +0800 Add remoteApplicationName in RpcContext (#3816) --- .../src/main/java/org/apache/dubbo/rpc/RpcContext.java | 13 +++++++++++++ .../java/org/apache/dubbo/rpc/filter/ContextFilter.java | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcContext.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcContext.java index 7c10081..fa63b7e 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcContext.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcContext.java @@ -85,6 +85,9 @@ public class RpcContext { private InetSocketAddress localAddress; private InetSocketAddress remoteAddress; + + private String remoteApplicationName; + @Deprecated private List<Invoker<?>> invokers; @Deprecated @@ -149,6 +152,7 @@ public class RpcContext { copy.arguments = this.arguments; copy.localAddress = this.localAddress; copy.remoteAddress = this.remoteAddress; + copy.remoteApplicationName = this.remoteApplicationName; copy.invokers = this.invokers; copy.invoker = this.invoker; copy.invocation = this.invocation; @@ -407,6 +411,15 @@ public class RpcContext { return this; } + public String getRemoteApplicationName() { + return remoteApplicationName; + } + + public RpcContext setRemoteApplicationName(String remoteApplicationName) { + this.remoteApplicationName = remoteApplicationName; + return this; + } + /** * get remote address string. * diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java index 7f30151..fe85da0 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java @@ -29,6 +29,8 @@ import org.apache.dubbo.rpc.RpcInvocation; import java.util.HashMap; import java.util.Map; +import static org.apache.dubbo.common.Constants.REMOTE_APPLICATION_KEY; + /** * ContextFilter set the provider RpcContext with invoker, invocation, local port it is using and host for * current execution thread. @@ -59,8 +61,8 @@ public class ContextFilter implements Filter { .setInvoker(invoker) .setInvocation(invocation) // .setAttachments(attachments) // merged from dubbox - .setLocalAddress(invoker.getUrl().getHost(), - invoker.getUrl().getPort()); + .setLocalAddress(invoker.getUrl().getHost(), invoker.getUrl().getPort()) + .setRemoteApplicationName(invoker.getUrl().getParameter(REMOTE_APPLICATION_KEY)); // merged from dubbox // we may already added some attachments into RpcContext before this filter (e.g. in rest protocol)