kylixs commented on a change in pull request #9015:
URL: https://github.com/apache/dubbo/pull/9015#discussion_r735229463
##########
File path:
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/RemotingScopeModelInitializer.java
##########
@@ -41,14 +41,25 @@ public void initializeFrameworkModel(FrameworkModel
frameworkModel) {
@Override
public void initializeApplicationModel(ApplicationModel applicationModel) {
applicationModel.addDestroyListener(m -> {
- // destroy zookeeper clients if any
try {
- List<ZookeeperTransporter> transporters =
applicationModel.getExtensionLoader(ZookeeperTransporter.class).getLoadedExtensionInstances();
+ List<ZookeeperTransporter> transporters =
FrameworkModel.defaultModel()
+
.getExtensionLoader(ZookeeperTransporter.class).getLoadedExtensionInstances();
+ if (transporters.isEmpty()) {
+ return;
+ }
+ // close unused zookeeper clients.
+ String applicationName =
applicationModel.tryGetApplicationName();
for (ZookeeperTransporter zkTransporter : transporters) {
- zkTransporter.destroy();
+ try {
+ zkTransporter.close(applicationName);
Review comment:
Need change `ZookeeperTransporter` to framework scope, and then test
whether the creation and destruction of the zk client meets expectations.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]