You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/11/14 10:34:10 UTC

[GitHub] [dubbo] haoxz11 opened a new pull request, #10937: Fix the warning problem when invokerUrls is checked

haoxz11 opened a new pull request, #10937:
URL: https://github.com/apache/dubbo/pull/10937

   ## What is the purpose of the change
   
   Fix the warning problem when invokerUrls is checked
   
   ## Brief changelog
   
   dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
   
   ## Verifying this change
   
   <!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
   - [x] Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
   - [x] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [x] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
   - [x] GitHub Actions works fine on your own branch.
   - [x] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] sonarcloud[bot] commented on pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#issuecomment-1322992008

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=10937)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=10937&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=10937&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=10937&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=CODE_SMELL) [539 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=CODE_SMELL)
   
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=10937&metric=new_coverage&view=list) [0.0% Coverage](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=10937&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=10937&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=10937&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] haoxz11 commented on a diff in pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
haoxz11 commented on code in PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#discussion_r1022242023


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java:
##########
@@ -231,14 +231,14 @@ private void refreshInvoker(List<URL> invokerUrls) {
             }
             // use local reference to avoid NPE as this.cachedInvokerUrls will be set null by destroyAllInvokers().
             Set<URL> localCachedInvokerUrls = this.cachedInvokerUrls;
-            if (invokerUrls.isEmpty() && localCachedInvokerUrls != null) {
-
-                // 1-4 Empty address.
-                logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
-                    "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
-
-                invokerUrls.addAll(localCachedInvokerUrls);
+            if (invokerUrls.isEmpty()) {
+                if(localCachedInvokerUrls != null){
+                    // 1-4 Empty address.

Review Comment:
   不然zk注册中心下,消费者启动会报大量告警;
   
   ![image](https://user-images.githubusercontent.com/16596043/201808386-ec6dddda-6955-4272-a78a-cdbfef6f51b4.png)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] codecov-commenter commented on pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#issuecomment-1322995546

   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/10937?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#10937](https://codecov.io/gh/apache/dubbo/pull/10937?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (68b92fd) into [3.1](https://codecov.io/gh/apache/dubbo/commit/00dad5feac9c2890c42547d64c3db8d985f2b405?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (00dad5f) will **decrease** coverage by `0.17%`.
   > The diff coverage is `25.00%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##                3.1   #10937      +/-   ##
   ============================================
   - Coverage     64.86%   64.68%   -0.18%     
     Complexity       14       14              
   ============================================
     Files          1421     1418       -3     
     Lines         58892    58850      -42     
     Branches       8646     8638       -8     
   ============================================
   - Hits          38199    38068     -131     
   - Misses        16675    16756      +81     
   - Partials       4018     4026       +8     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/10937?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../dubbo/registry/integration/RegistryDirectory.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9pbnRlZ3JhdGlvbi9SZWdpc3RyeURpcmVjdG9yeS5qYXZh) | `45.93% <25.00%> (-0.88%)` | :arrow_down: |
   | [...dubbo/rpc/protocol/dubbo/pu/DubboWireProtocol.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL3B1L0R1YmJvV2lyZVByb3RvY29sLmphdmE=) | `40.00% <0.00%> (-60.00%)` | :arrow_down: |
   | [...nter/initializer/DownloadZookeeperInitializer.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tdGVzdC9kdWJiby10ZXN0LWNoZWNrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby90ZXN0L2NoZWNrL3JlZ2lzdHJ5Y2VudGVyL2luaXRpYWxpemVyL0Rvd25sb2FkWm9va2VlcGVySW5pdGlhbGl6ZXIuamF2YQ==) | `5.88% <0.00%> (-54.91%)` | :arrow_down: |
   | [...he/dubbo/rpc/cluster/support/MergeableCluster.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY2x1c3Rlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL2NsdXN0ZXIvc3VwcG9ydC9NZXJnZWFibGVDbHVzdGVyLmphdmE=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [...center/initializer/UnpackZookeeperInitializer.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tdGVzdC9kdWJiby10ZXN0LWNoZWNrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby90ZXN0L2NoZWNrL3JlZ2lzdHJ5Y2VudGVyL2luaXRpYWxpemVyL1VucGFja1pvb2tlZXBlckluaXRpYWxpemVyLmphdmE=) | `42.55% <0.00%> (-34.05%)` | :arrow_down: |
   | [...che/dubbo/rpc/protocol/dubbo/pu/DubboDetector.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy1kdWJiby9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcnBjL3Byb3RvY29sL2R1YmJvL3B1L0R1YmJvRGV0ZWN0b3IuamF2YQ==) | `30.00% <0.00%> (-30.00%)` | :arrow_down: |
   | [...o/rpc/protocol/tri/transport/GracefulShutdown.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcnBjL2R1YmJvLXJwYy10cmlwbGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JwYy9wcm90b2NvbC90cmkvdHJhbnNwb3J0L0dyYWNlZnVsU2h1dGRvd24uamF2YQ==) | `51.85% <0.00%> (-29.63%)` | :arrow_down: |
   | [...remoting/transport/netty4/NettyConfigOperator.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctbmV0dHk0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbmV0dHk0L05ldHR5Q29uZmlnT3BlcmF0b3IuamF2YQ==) | `51.61% <0.00%> (-29.04%)` | :arrow_down: |
   | [...oting/exchange/support/header/HeaderExchanger.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy9leGNoYW5nZS9zdXBwb3J0L2hlYWRlci9IZWFkZXJFeGNoYW5nZXIuamF2YQ==) | `71.42% <0.00%> (-28.58%)` | :arrow_down: |
   | [...gistrycenter/processor/ZookeeperUnixProcessor.java](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tdGVzdC9kdWJiby10ZXN0LWNoZWNrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby90ZXN0L2NoZWNrL3JlZ2lzdHJ5Y2VudGVyL3Byb2Nlc3Nvci9ab29rZWVwZXJVbml4UHJvY2Vzc29yLmphdmE=) | `60.71% <0.00%> (-17.86%)` | :arrow_down: |
   | ... and [47 more](https://codecov.io/gh/apache/dubbo/pull/10937/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] sonarcloud[bot] commented on pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#issuecomment-1313460306

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=10937)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=10937&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=10937&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=10937&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=10937&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=10937&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=10937&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#discussion_r1022244138


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java:
##########
@@ -231,14 +231,14 @@ private void refreshInvoker(List<URL> invokerUrls) {
             }
             // use local reference to avoid NPE as this.cachedInvokerUrls will be set null by destroyAllInvokers().
             Set<URL> localCachedInvokerUrls = this.cachedInvokerUrls;
-            if (invokerUrls.isEmpty() && localCachedInvokerUrls != null) {
-
-                // 1-4 Empty address.
-                logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
-                    "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
-
-                invokerUrls.addAll(localCachedInvokerUrls);
+            if (invokerUrls.isEmpty()) {
+                if(localCachedInvokerUrls != null){
+                    // 1-4 Empty address.

Review Comment:
   get



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] haoxz11 commented on a diff in pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
haoxz11 commented on code in PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#discussion_r1022239874


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java:
##########
@@ -231,14 +231,14 @@ private void refreshInvoker(List<URL> invokerUrls) {
             }
             // use local reference to avoid NPE as this.cachedInvokerUrls will be set null by destroyAllInvokers().
             Set<URL> localCachedInvokerUrls = this.cachedInvokerUrls;
-            if (invokerUrls.isEmpty() && localCachedInvokerUrls != null) {
-
-                // 1-4 Empty address.
-                logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
-                    "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
-
-                invokerUrls.addAll(localCachedInvokerUrls);
+            if (invokerUrls.isEmpty()) {
+                if(localCachedInvokerUrls != null){
+                    // 1-4 Empty address.

Review Comment:
   > 这个修改从代码编译后的效果上来看是一样的
   
   ![image](https://user-images.githubusercontent.com/16596043/201807631-2fd923ba-dcd6-4b83-98fc-fc49722d1fd1.png)
   
   ![image](https://user-images.githubusercontent.com/16596043/201807800-eb744914-e6f9-4a8b-a82f-35c3b7d2dc16.png)
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#discussion_r1022236995


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java:
##########
@@ -231,14 +231,14 @@ private void refreshInvoker(List<URL> invokerUrls) {
             }
             // use local reference to avoid NPE as this.cachedInvokerUrls will be set null by destroyAllInvokers().
             Set<URL> localCachedInvokerUrls = this.cachedInvokerUrls;
-            if (invokerUrls.isEmpty() && localCachedInvokerUrls != null) {
-
-                // 1-4 Empty address.
-                logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
-                    "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
-
-                invokerUrls.addAll(localCachedInvokerUrls);
+            if (invokerUrls.isEmpty()) {
+                if(localCachedInvokerUrls != null){
+                    // 1-4 Empty address.

Review Comment:
   这个修改从代码编译后的效果上来看是一样的



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] CrazyHZM commented on a diff in pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
CrazyHZM commented on code in PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#discussion_r1022384042


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java:
##########
@@ -231,14 +231,14 @@ private void refreshInvoker(List<URL> invokerUrls) {
             }
             // use local reference to avoid NPE as this.cachedInvokerUrls will be set null by destroyAllInvokers().
             Set<URL> localCachedInvokerUrls = this.cachedInvokerUrls;
-            if (invokerUrls.isEmpty() && localCachedInvokerUrls != null) {
-
-                // 1-4 Empty address.
-                logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
-                    "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
-
-                invokerUrls.addAll(localCachedInvokerUrls);
+            if (invokerUrls.isEmpty()) {
+                if(localCachedInvokerUrls != null){
+                    // 1-4 Empty address.
+                    logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
+                        "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
 
+                    invokerUrls.addAll(localCachedInvokerUrls);
+                }

Review Comment:
   Agree with @AlbumenJ 
   A small suggestion:  use `CollectionUtils.isNotEmpty` to judge empty



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #10937:
URL: https://github.com/apache/dubbo/pull/10937#discussion_r1022252374


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java:
##########
@@ -231,14 +231,14 @@ private void refreshInvoker(List<URL> invokerUrls) {
             }
             // use local reference to avoid NPE as this.cachedInvokerUrls will be set null by destroyAllInvokers().
             Set<URL> localCachedInvokerUrls = this.cachedInvokerUrls;
-            if (invokerUrls.isEmpty() && localCachedInvokerUrls != null) {
-
-                // 1-4 Empty address.
-                logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
-                    "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
-
-                invokerUrls.addAll(localCachedInvokerUrls);
+            if (invokerUrls.isEmpty()) {
+                if(localCachedInvokerUrls != null){
+                    // 1-4 Empty address.
+                    logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
+                        "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
 
+                    invokerUrls.addAll(localCachedInvokerUrls);
+                }

Review Comment:
   ```suggestion
               if (invokerUrls.isEmpty()) {
                   if (localCachedInvokerUrls != null && !localCachedInvokerUrls.isEmpty()) {
                       // if the previous invokerUrls is not empty, warn and use the previous invokerUrls instead.
                       
                       // 1-4 Empty address.
                       logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
                           "Service" + serviceKey + " received empty address list with no EMPTY protocol set, trigger empty protection.");
   
                       invokerUrls.addAll(localCachedInvokerUrls);
                   } // else, if the previous invokerUrls is empty, do nothing.
               } else {
                   // cache if invokerUrls is not empty
                   localCachedInvokerUrls = new HashSet<>();
                   localCachedInvokerUrls.addAll(invokerUrls);//Cached invoker urls, convenient for comparison
                   this.cachedInvokerUrls = localCachedInvokerUrls;
               }
   ```
   
   Please add some comment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ merged pull request #10937: Fix the warning problem when invokerUrls is checked

Posted by GitBox <gi...@apache.org>.
AlbumenJ merged PR #10937:
URL: https://github.com/apache/dubbo/pull/10937


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org