Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommonProxyFactory这个类里面有bug #1065

Open
traveltheworldd opened this issue Jul 3, 2024 · 1 comment
Open

CommonProxyFactory这个类里面有bug #1065

traveltheworldd opened this issue Jul 3, 2024 · 1 comment

Comments

@traveltheworldd
Copy link

@SpiMeta(name = "common")
public class CommonProxyFactory implements ProxyFactory {

@Override
@SuppressWarnings("unchecked")
public <T> T getProxy(Class<T> clz, List<Cluster<T>> clusters) {
    return (T) new RefererCommonHandler(clusters.get(0).getUrl().getPath(), clusters);
}

@Override
@SuppressWarnings("unchecked")
public <T> T getProxy(Class<T> clz, URL refUrl, MeshClient meshClient) {
    return (T) new MeshClientRefererInvocationHandler(refUrl, meshClient);
}

}

return (T) new RefererCommonHandler(clusters.get(0).getUrl().getPath(), clusters);

这个地方强制转换是会报错的,是个bug,大家用的时候注意下,这个common的代理是行不通的

@weibocom weibocom deleted a comment from sevenDay2014 Jul 4, 2024
@rayzhang0603
Copy link
Collaborator

CommonProxyFactory不是使用在动态代理场景的,是用来创建CommonClient或MeshClient,用在调用其他语言RPC或者MotanMesh的场景使用的。

这种场景下Java侧没有其他语言对应的service类,所以不能使用动态代理方式,需要使用client方式请求其他语言的RPC服务

CommonClient的使用方式可以参考Demo中的Motan2RpcClient

MeshClient的使用方式可以参考Demo中的DemoMeshClient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants