This is an automated email from the ASF dual-hosted git repository.

earthchen pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new d552cfca51 Fix generic invoke failed for triple (#13442)
d552cfca51 is described below

commit d552cfca51a07765b080a84b8bddd044a694bc98
Author: Albumen Kevin <jhq0...@gmail.com>
AuthorDate: Fri Dec 1 10:25:03 2023 +0800

    Fix generic invoke failed for triple (#13442)
---
 .../dubbo/rpc/protocol/tri/TripleInvoker.java      | 25 ++++++----------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git 
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java
 
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java
index 76b26247cb..32789bb0d5 100644
--- 
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java
+++ 
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java
@@ -24,7 +24,6 @@ import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
 import org.apache.dubbo.common.logger.LoggerFactory;
 import org.apache.dubbo.common.stream.StreamObserver;
 import org.apache.dubbo.common.threadpool.ThreadlessExecutor;
-import org.apache.dubbo.common.utils.ReflectUtils;
 import org.apache.dubbo.remoting.api.connection.AbstractConnectionClient;
 import org.apache.dubbo.rpc.AppResponse;
 import org.apache.dubbo.rpc.AsyncRpcResult;
@@ -143,12 +142,12 @@ public class TripleInvoker<T> extends AbstractInvoker<T> {
         ConsumerModel consumerModel = (ConsumerModel)
                 (invocation.getServiceModel() != null ? 
invocation.getServiceModel() : getUrl().getServiceModel());
         ServiceDescriptor serviceDescriptor = consumerModel.getServiceModel();
-        final MethodDescriptor methodDescriptor;
-        boolean genericCall = RpcUtils.isGenericCall(
-                ReflectUtils.getDesc(invocation.getParameterTypes()), 
invocation.getMethodName());
-        if (!genericCall) {
-            methodDescriptor = 
serviceDescriptor.getMethod(invocation.getMethodName(), 
invocation.getParameterTypes());
-        } else {
+        MethodDescriptor methodDescriptor =
+                serviceDescriptor.getMethod(invocation.getMethodName(), 
invocation.getParameterTypes());
+        if (methodDescriptor == null
+                && RpcUtils.isGenericCall(
+                        ((RpcInvocation) invocation).getParameterTypesDesc(), 
invocation.getMethodName())) {
+            // Only reach when server generic
             methodDescriptor = ServiceDescriptorInternalCache.genericService()
                     .getMethod(invocation.getMethodName(), 
invocation.getParameterTypes());
         }
@@ -261,17 +260,7 @@ public class TripleInvoker<T> extends AbstractInvoker<T> {
         if (methodDescriptor instanceof StubMethodDescriptor) {
             pureArgument = invocation.getArguments()[0];
         } else {
-            if (methodDescriptor.isGeneric()) {
-                Object[] args = new Object[3];
-                args[0] = RpcUtils.getMethodName(invocation);
-                args[1] = Arrays.stream(RpcUtils.getParameterTypes(invocation))
-                        .map(Class::getName)
-                        .toArray(String[]::new);
-                args[2] = RpcUtils.getArguments(invocation);
-                pureArgument = args;
-            } else {
-                pureArgument = invocation.getArguments();
-            }
+            pureArgument = invocation.getArguments();
         }
         result = new AsyncRpcResult(future, invocation);
         if (setFutureWhenSync || ((RpcInvocation) invocation).getInvokeMode() 
!= InvokeMode.SYNC) {

Reply via email to