-
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
fix #3179. Make registry, configcenter, matadata-report share a zooke… #3182
Conversation
… zookeeper connection
…re a zookeeper connection
Codecov Report
@@ Coverage Diff @@
## 2.7.0-release #3182 +/- ##
=================================================
+ Coverage 63.79% 63.9% +0.1%
Complexity 75 75
=================================================
Files 651 652 +1
Lines 28311 28355 +44
Branches 4792 4800 +8
=================================================
+ Hits 18061 18120 +59
+ Misses 7980 7964 -16
- Partials 2270 2271 +1
Continue to review full report at Codecov.
|
...eeper/src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperClient.java
Outdated
Show resolved
Hide resolved
...keeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
Outdated
Show resolved
Hide resolved
...keeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Outdated
Show resolved
Hide resolved
...adata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java
Outdated
Show resolved
Hide resolved
...eport-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReportFactory.java
Show resolved
Hide resolved
...adata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java
Outdated
Show resolved
Hide resolved
...keeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
Outdated
Show resolved
Hide resolved
...keeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Outdated
Show resolved
Hide resolved
@@ -16,18 +16,17 @@ | |||
*/ | |||
package org.apache.dubbo.remoting.zookeeper.zkclient; | |||
|
|||
import org.I0Itec.zkclient.IZkChildListener; |
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.
double check all import sequence. I believe this will break CI. We have import rule configured, 'org.apache.dubbo' should go first.
… sharing zookeeper connection, it should judge zookeeperClient.isConnected()
.../src/main/java/org/apache/dubbo/remoting/zookeeper/support/AbstractZookeeperTransporter.java
Show resolved
Hide resolved
// avoid creating too many connections, so add lock | ||
synchronized (zookeeperClientMap) { | ||
if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) { | ||
logger.info("Get result from map for the second time when invoking zookeeperTransporter.connnect ."); |
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.
"find valid zookeeper client from the cache for address: " + addressList.toString()
} | ||
|
||
zookeeperClient = createZookeeperClient(createServerURL(url)); | ||
logger.info("Get result by creating new connection when invoking zookeeperTransporter.connnect ."); |
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.
"no valid zookeeper client found from cache, therefore create a new client for url " + url.
* @param url | ||
* @return | ||
*/ | ||
URL createServerURL(URL url) { |
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.
need a better method name, say: toClientUrl()
import org.I0Itec.zkclient.IZkChildListener; | ||
import org.I0Itec.zkclient.IZkStateListener; | ||
import org.I0Itec.zkclient.ZkClient; | ||
import org.apache.dubbo.common.logger.Logger; |
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.
import order, check style.
this pull request has too many comments already. Pls. submit a separated pull request for the pending comments. |
fix #3179 , #3205, #3218
In dubbo 2.7, we introduce config-center, metadata-report and we define SPI for them. There are zookeeper extension for config-center and medata-report.
So far, there are 3 connections that are used for registry, config-center, metadata-report .
We should use one connection that can be shared with registry, config-center, metadata-report .
Add group field into MetadataReportConfig.
When get ZookeeperClient, must make it is connected.