Skip to content

Commit

Permalink
Fix generic invoke failed for triple (apache#13442)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ authored Dec 1, 2023
1 parent 841ddb6 commit d552cfc
Showing 1 changed file with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
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;
Expand Down Expand Up @@ -143,12 +142,12 @@ protected Result doInvoke(final Invocation invocation) {
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());
}
Expand Down Expand Up @@ -261,17 +260,7 @@ AsyncRpcResult invokeUnary(
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) {
Expand Down

0 comments on commit d552cfc

Please sign in to comment.