1616 */
1717package org .apache .dubbo .config .metadata ;
1818
19+ import org .apache .dubbo .common .URL ;
1920import org .apache .dubbo .common .logger .ErrorTypeAwareLogger ;
2021import org .apache .dubbo .common .logger .LoggerFactory ;
2122import org .apache .dubbo .common .threadpool .manager .FrameworkExecutorRepository ;
3132import org .apache .dubbo .registry .client .metadata .MetadataServiceDelegationV2 ;
3233import org .apache .dubbo .rpc .model .ApplicationModel ;
3334
35+ import java .util .ArrayList ;
3436import java .util .Collections ;
3537import java .util .List ;
3638import java .util .concurrent .ExecutorService ;
@@ -71,7 +73,7 @@ public ConfigurableMetadataServiceExporter(
7173 }
7274
7375 public synchronized ConfigurableMetadataServiceExporter export () {
74- if (serviceConfig == null || !isExported ()) {
76+ if (!isExported ()) {
7577 if (MetadataServiceVersionUtils .needExportV1 (applicationModel )) {
7678 exportV1 ();
7779 }
@@ -84,13 +86,28 @@ public synchronized ConfigurableMetadataServiceExporter export() {
8486 CONFIG_METADATA_SERVICE_EXPORTED ,
8587 "" ,
8688 "" ,
87- "The MetadataService has been exported : " + serviceConfig . getExportedUrls ());
89+ "The MetadataService has been exported : " + getExportedUrls ());
8890 }
8991 }
9092
9193 return this ;
9294 }
9395
96+ /**
97+ * Get exported urls which include v1 and v2 if existed
98+ * @return exported urls
99+ */
100+ public List <URL > getExportedUrls () {
101+ List <URL > urls = new ArrayList <>();
102+ if (serviceConfig != null ) {
103+ urls .addAll (serviceConfig .getExportedUrls ());
104+ }
105+ if (serviceConfigV2 != null ) {
106+ urls .addAll (serviceConfigV2 .getExportedUrls ());
107+ }
108+ return urls ;
109+ }
110+
94111 private static final String INTERNAL_METADATA_REGISTRY_ID = "internal-metadata-registry" ;
95112
96113 private void exportV1 () {
0 commit comments