Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ public RpcInvocation(Method method, Object[] arguments) {
this(method.getName(), method.getParameterTypes(), arguments, null, null);
}

public RpcInvocation(Method method, Object[] arguments, Map<String, String> attachment) {
public RpcInvocation(Method method, Object[] arguments, Map<String, String> attachment, Map<Object, Object> attributes) {
this(method.getName(), method.getParameterTypes(), arguments, attachment, null);
this.returnType = method.getReturnType();
this.attributes = attributes == null ? new HashMap<>() : attributes;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if attributes will be passed downstream by the framework automatically.

I remember RpcInvocation is not encoded as a whole:
https://github.com/apache/incubator-dubbo/blob/ebe3e424579d5986bf4cbb518ca6a4ff28f9a257/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboCodec.java#L187

}

public RpcInvocation(String methodName, Class<?>[] parameterTypes, Object[] arguments) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Result invoke(Invoker<?> invoker, Invocation inv) throws RpcException {
} else if (ProtocolUtils.isJavaGenericSerialization(generic)) {
for (int i = 0; i < args.length; i++) {
if (byte[].class == args[i].getClass()) {
try(UnsafeByteArrayInputStream is = new UnsafeByteArrayInputStream((byte[]) args[i])) {
try (UnsafeByteArrayInputStream is = new UnsafeByteArrayInputStream((byte[]) args[i])) {
args[i] = ExtensionLoader.getExtensionLoader(Serialization.class)
.getExtension(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA)
.deserialize(null, is).readObject();
Expand Down Expand Up @@ -111,7 +111,8 @@ public Result invoke(Invoker<?> invoker, Invocation inv) throws RpcException {
}
}
}
return invoker.invoke(new RpcInvocation(method, args, inv.getAttachments()));

return invoker.invoke(new RpcInvocation(method, args, inv.getAttachments(), inv.getAttributes()));
} catch (NoSuchMethodException e) {
throw new RpcException(e.getMessage(), e);
} catch (ClassNotFoundException e) {
Expand Down