DiegoKrupitza commented on a change in pull request #9003:
URL: https://github.com/apache/dubbo/pull/9003#discussion_r725508800
##########
File path:
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
##########
@@ -924,8 +924,21 @@ private void destroyMetadataReports() {
private void destroyDynamicConfigurations() {
// TODO only destroy DynamicConfiguration of this application
// DynamicConfiguration may be cached somewhere, and maybe used during
destroy
- // destroy them may cause some troubles, so just clear instances cache
- //
ExtensionLoader.resetExtensionLoader(DynamicConfigurationFactory.class);
+ // destroy them may cause some troubles,
+ // but let them go also cause troubles such as configCenter connection
leak.
+ if (environment.getDynamicConfiguration().isPresent() &&
+ environment.getDynamicConfiguration().get() instanceof
CompositeDynamicConfiguration) {
Review comment:
I think you can simplify this `if`by using the `filter(...)` method of
Optional.
I suggest to change it to
```Java
var optionalOfTypeCompositeDynamicConfiguration =
environment.getDynamicConfiguration()
.filter(item -> item instanceof CompositeDynamicConfiguration);
if (optionalOfTypeCompositeDynamicConfiguration.isPresent()) {
var compositeDynamicConfiguration =
optionalOfTypeCompositeDynamicConfiguration.get();
// rest of the logic
}
```
--
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]