-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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
[DUBBO-2988] Unrecognized the other provider #3013
Conversation
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
Outdated
Show resolved
Hide resolved
dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/url/UrlTestBase.java
Show resolved
Hide resolved
dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/Ls.java
Show resolved
Hide resolved
...o-registry-api/src/main/java/org/apache/dubbo/registry/support/ProviderConsumerRegTable.java
Outdated
Show resolved
Hide resolved
...o-registry-api/src/main/java/org/apache/dubbo/registry/support/ProviderConsumerRegTable.java
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #3013 +/- ##
==========================================
+ Coverage 64.3% 64.32% +0.01%
==========================================
Files 584 584
Lines 26056 26084 +28
Branches 4562 4559 -3
==========================================
+ Hits 16755 16778 +23
- Misses 7118 7129 +11
+ Partials 2183 2177 -6
Continue to review full report at Codecov.
|
dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java
Show resolved
Hide resolved
dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java
Show resolved
Hide resolved
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/model/ApplicationModel.java
Show resolved
Hide resolved
this.serviceName = serviceName; | ||
this.serviceInterfaceClass = serviceInterfaceClass; | ||
this.proxyObject = proxyObject; | ||
|
||
if (proxyObject != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is methods and attributes are optional and can be consider my this class only if proxyObject not null? If this is the case then can we have two constructor one with only service and another one with all the parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid I don't fully understand, could you pls. rephrase your concern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is my bad I failed to explain it.
The constructor ConsumerModel takes 5 parameter where methods and attributes are are getting used if and only if **proxyObject ** is not null. So if **proxyObject ** is null then rest of the two methods and attributes are not getting used. So to keep it simple I was saying we can have two constructor
public ConsumerModel(String serviceName, Class<?> serviceInterfaceClass)
public ConsumerModel(String serviceName, Class<?> serviceInterfaceClass, Object proxyObject, Method[] methods, Map<String, Object> attributes)
So using constructor definition it will be easy to understand by the user that object created using constructor 1 does not deal with proxy object, methods and attributes, object populated with these 3 parameter will be null or empty. Where if someone populate object using constructor 2 will be dealing with rest of the parameters and explicitly throw exception of proxyObject is null.
Do let me know if I am able to explain the scenario or whether it make sense or not to consider this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, if (proxyObject != null)
is a defensive programming. In Dubbo, proxyObject should not be null and will not be null.
I guess we should change it to assert
or throw IllegelArgumentException
, would you mind take care of this in other change?
This change contains too much already, in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
...-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java
Outdated
Show resolved
Hide resolved
...-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java
Outdated
Show resolved
Hide resolved
...-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java
Outdated
Show resolved
Hide resolved
...bo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/ListTelnetHandler.java
Show resolved
Hide resolved
...bo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/ListTelnetHandler.java
Outdated
Show resolved
Hide resolved
...bo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/ListTelnetHandler.java
Show resolved
Hide resolved
...bo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/ListTelnetHandler.java
Outdated
Show resolved
Hide resolved
...bo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/ListTelnetHandler.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are few changes we can do from readability point of view, which we can do ltr once this PR is merged and for the same I have created an issue #3032.
This changes looks good to me.
since there's no further comments, I will merge this pull request. @khanimteyaz you can continue your work based on it. |
RpcResult result = new RpcResult(); | ||
try { | ||
Object o = invokeMethod.invoke(selectedProvider.getServiceInstance(), array); | ||
result.setValue(o); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt that invoking the underlying service instance directly bypassing Dubbo's proxy will make this invoke
command meaningless. For a reading service, the result may be qualified as a reflection of that it will behave in production; for a writing service, the side effects may be not predictable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chickenlj would be possible to explain this in a bit more details (you might have already explained it, but for the shake of mine understanding it would great if you can again)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khanimteyaz
Hi, I tried to explain it instead of him.
In dubbo, the Provider side exposes a Proxy object instead of the actual ServiceImpl object (such as UserServiceImpl).
If we try to call UserServiceImpl directly, then we actually bypass the proxy class of UserServiceImpl (this proxy class is produced by dubbo).
Telnet is to test the effect of a method. If we bypass the entire proxy and only test UserServiceImpl, then it is meaningless. The effect of this operation is equivalent to Unit Test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carryxyh . Got it. Thanks for expplaing it to me. What you saying is make sense and I think we allow to use the actual call path instead of by pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) { | ||
if (service.equals(exporter.getInvoker().getInterface().getSimpleName()) | ||
|| service.equals(exporter.getInvoker().getInterface().getName()) | ||
|| service.equals(exporter.getInvoker().getUrl().getPath())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
service.equals(exporter.getInvoker().getUrl().getPath())
This condition will lost in the new implementation while the Model concept used only takes group/service:version
into account. I am a little confused about the relation between path
and group/service:version
at this moment, but I think we should be careful before we can think of them clearly enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes agree that for changes we should be thought full. In this case what approach we could take to make it better. If you could guide, we would make change to enhance it?
@beiwei30 @khanimteyaz |
What is the purpose of the change
fix #2988
Brief changelog
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
dubbo-demo/dubbo-demo-provider/src/main/java/org/apache/dubbo/demo/provider/ServiceA.java
dubbo-demo/dubbo-demo-provider/src/main/java/org/apache/dubbo/demo/provider/ServiceB.java
dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/Ls.java
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/ProviderConsumerRegTable.java
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/model/ConsumerModel.java
dubbo-rpc/dubbo-rpc-dubbo/pom.xml
dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java
dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/telnet/ListTelnetHandler.java
dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ImplicitCallBackTest.java
Verifying this change
XXXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests=false
&mvn clean test-compile failsafe:integration-test
to make sure unit-test and integration-test pass.