zrlw commented on code in PR #15639:
URL: https://github.com/apache/dubbo/pull/15639#discussion_r2311775236
##########
dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactory.java:
##########
@@ -65,23 +65,21 @@ public MetadataReport getMetadataReport(URL url) {
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 (!metadataReport.isAvailable()) {
+ logger.warn(PROXY_FAILED_EXPORT_SERVICE, "", "", "The
metadata reporter failed to initialize");
+ if (UrlUtils.isCheck(url)) {
+ throw new IllegalStateException(
+ "Can't create metadata-report client, the
connection is not available, check fail.");
+ }
}
+ } catch (Exception e) {
Review Comment:
maybe we should catch exception before checking metadataReport.
--
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]