wukaixian commented on issue #13371:
URL: https://github.com/apache/dubbo/issues/13371#issuecomment-1813929583
It seems that your configuration isn't working as expected. According to the
code snippet, `String key = url.toServiceString()`; does not include namespace
parameters in the key. In other words, for the same address with different
namespaces, only one metadataReport will be initialized. This setup does not
support metadata reporting for multiple namespaces.
This might be considered a bug as the key generated from the URL doesn't
account for namespace parameters, resulting in a limitation where only one
metadataReport is initialized even for different namespaces associated with the
same address.
``` java
public MetadataReport getMetadataReport(URL url) {
url = url.setPath(MetadataReport.class.getName())
.removeParameters(EXPORT_KEY, REFER_KEY);
String key = url.toServiceString();
MetadataReport metadataReport = serviceStoreMap.get(key);
if (metadataReport != null) {
return metadataReport;
}
// Lock the metadata access process to ensure a single instance of
the metadata instance
lock.lock();
try {
metadataReport = serviceStoreMap.get(key);
if (metadataReport != null) {
return metadataReport;
}
boolean check = url.getParameter(CHECK_KEY, true) &&
url.getPort() != 0;
try {
metadataReport = createMetadataReport(url);
} catch (Exception e) {
if (!check) {
logger.warn(PROXY_FAILED_EXPORT_SERVICE, "", "", "The
metadata reporter failed to initialize", e);
} else {
throw e;
}
}
if (check && metadataReport == null) {
throw new IllegalStateException("Can not create metadata
Report " + url);
}
if (metadataReport != null) {
serviceStoreMap.put(key, metadataReport);
}
return metadataReport;
} finally {
// Release the lock
lock.unlock();
}
}
```
--
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]