Skip to content

Commit

Permalink
remove interface key in contextFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
carryxyh committed Jan 24, 2019
1 parent 47f4a44 commit effefd4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,6 @@ public Result invoke(final Invocation invocation) throws RpcException {
Map<String, String> contextAttachments = RpcContext.getContext().getAttachments();
if (contextAttachments != null && contextAttachments.size() != 0) {
((RpcInvocation) invocation).addAttachments(contextAttachments);
// We need to remove the interface because the interface here may come from last invoke.
//
// See https://github.com/apache/incubator-dubbo/issues/2981
if (invocation.getAttachments() != null) {
invocation.getAttachments().remove(Constants.INTERFACE_KEY);
}
}

List<Invoker<T>> invokers = list(invocation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public class ContextFilter implements Filter {
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
Map<String, String> attachments = invocation.getAttachments();
if (attachments != null) {
attachments = new HashMap<String, String>(attachments);
attachments = new HashMap<>(attachments);
attachments.remove(Constants.PATH_KEY);
attachments.remove(Constants.INTERFACE_KEY);
attachments.remove(Constants.GROUP_KEY);
attachments.remove(Constants.VERSION_KEY);
attachments.remove(Constants.DUBBO_VERSION_KEY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public Result invoke(Invocation inv) throws RpcException {
}
RpcInvocation invocation = (RpcInvocation) inv;
invocation.setInvoker(this);

if (attachment != null && attachment.size() > 0) {
invocation.addAttachmentsIfAbsent(attachment);
}
Map<String, String> contextAttachments = RpcContext.getContext().getAttachments();
if (contextAttachments != null && contextAttachments.size() != 0) {
/**
Expand All @@ -150,15 +152,6 @@ public Result invoke(Invocation inv) throws RpcException {
}
RpcUtils.attachInvocationIdIfAsync(getUrl(), invocation);

// If we have attachment, override the attachment to ensure that the last invoke's attach does not affect this call.
// In most cases, attachments contains interface, timeout, group, and token.
// These info should be override in each invoke.
//
// See https://github.com/apache/incubator-dubbo/issues/2981
if (attachment != null && attachment.size() > 0) {
invocation.addAttachments(attachment);
}

try {
return doInvoke(invocation);
} catch (InvocationTargetException e) { // biz exception
Expand Down

0 comments on commit effefd4

Please sign in to comment.