-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
本地存根和本地伪装无法使用 #65
Comments
同样遇到了这个问题,等待高人解答 |
本地存根可以用,mock本地伪装用不了。 |
遇到同样的问题v2.5.3 有解决的吗 |
2.5.3还是有这个问题 |
是不是重启一下服务端,刷新一下服务列表就好了? |
dubbo的本地伪装有谁成功实现过。按照dubbo官方文档设置。然后关于服务提供方服务。服务调用方调用接口也是会失败的。 |
2.5.3 还是有这个不能本地伪装的问题存在 |
在AbstractRegistry中有一段这样的代码 for (Map.Entry<String, List> entry : result.entrySet()) {
String category = entry.getKey();
List categoryList = entry.getValue();
categoryNotified.put(category, categoryList);
saveProperties(url);
listener.notify(categoryList);
} 这里的result内容如下
在jdk1.7中第一次循环取的是providers。后面的逻辑会去刷新forbidden字段(refreshInvoker方法)。此时是forbidden设置为true,第二次循环会设置为false,第三次会设置成false。此时可以本地伪装。 但是在jdk1.8中第一次循环去的是configurators。后面的逻辑会去刷新forbidden字段(refreshInvoker方法)。此时是forbidden设置为false,第二次循环会设置为true,第三次会设置成true。此时就本地伪装就没法调用 |
Local stub works only when providers >= 1. Local mock's bug has fixed, please check https://github.com/apache/incubator-dubbo/blob/fd7bab3cdf2650168e9eca625fd5311ffc7b1f5a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java#L142 Feel free to reopen it or open a new issue if you have any other questions. |
文档上写的本地存根和本地伪装在调用失败的时候会进行一些处理,但是我在测试环境使用的时候把全部服务端关掉之后,就无法使用了,再次调用会抛出异常,信息如下:
看源码发现RegistryDirectory类中forbidden属性已经变成true了,原因在于没有服务端的时候,会接收到通知,RegistryDirectory类会调用refreshInvoker方法,如下:
这个时候在去调用stub和mock都会抛出异常。所以我怀疑这个特性根本无法使用,但是文档上写的可以在生产中使用,有使用过这特特性的同学吗
The text was updated successfully, but these errors were encountered: