Skip to content

Dubbo3TripleGenerator生成的xxxAsync方法本质上仍然是阻塞的,这样做的意义是什么? #11447

@linsida1

Description

@linsida1

通过dubbo-compiler的插件生成了接口,会自动生成xxxAsync()方法,但是它只是通过CompletableFuture.completedFuture()包装了同步方法,它仍然会阻塞consumer的业务线程。这么实现的目的是什么?

image

image

Ask your question here

我当前使用dubbo 3.1.4的triple协议(同时使用了IDL+protobuf),想提供CompletableFuture返回值的异步调用,应该怎么做?

客户端如果不使用proxy=“nativestub”,会抛出以下错误:

This serialization only support google protobuf messages, but the actual input type is :java.util.concurrent.CompletableFuture

客户端如果使用proxy=“nativestub”,调用kickOffDeviceAsync(),实际上会调用CompletableFuture.completedFuture(kickOffDevice(request));.如此就会造成阻塞了,没有达到异步的目的

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions