diff --git a/dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java b/dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java index 0c864c4188..21fb318fd9 100644 --- a/dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java +++ b/dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java @@ -84,7 +84,6 @@ import static org.apache.dubbo.common.function.ThrowableAction.execute; import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty; import static org.apache.dubbo.config.context.ConfigManager.getInstance; import static org.apache.dubbo.metadata.WritableMetadataService.getExtension; -import static org.apache.dubbo.metadata.WritableMetadataService.getMetadataStorageType; import static org.apache.dubbo.registry.client.metadata.ServiceInstanceMetadataUtils.setMetadataStorageType; import static org.apache.dubbo.remoting.Constants.CLIENT_KEY; @@ -129,13 +128,6 @@ public class DubboBootstrap extends GenericEventListener implements Lifecycle { private volatile boolean started = false; - /** - * Only Provider Register - */ - private volatile boolean onlyRegisterProvider = false; - - private volatile boolean defaultMetadataStorageType = true; - private volatile ServiceInstance serviceInstance; private volatile MetadataService metadataService; @@ -161,28 +153,13 @@ public class DubboBootstrap extends GenericEventListener implements Lifecycle { }); } - /** - * Set only register provider or not - * - * @param onlyRegisterProvider if true, only register the provider and reduce the registries' load. - * @return {@link DubboBootstrap} - */ - public DubboBootstrap onlyRegisterProvider(boolean onlyRegisterProvider) { - this.onlyRegisterProvider = onlyRegisterProvider; - return this; + private boolean isOnlyRegisterProvider() { + Boolean registerConsumer = configManager.getApplicationOrElseThrow().getRegisterConsumer(); + return registerConsumer == null || !registerConsumer; } - public boolean isOnlyRegisterProvider() { - return onlyRegisterProvider; - } - - public boolean isDefaultMetadataStorageType() { - return defaultMetadataStorageType; - } - - public DubboBootstrap defaultMetadataStorageType(boolean defaultMetadataStorageType) { - this.defaultMetadataStorageType = defaultMetadataStorageType; - return this; + private String getMetadataType() { + return configManager.getApplicationOrElseThrow().getMetadataType(); } public DubboBootstrap metadataReport(MetadataReportConfig metadataReportConfig) { @@ -456,8 +433,6 @@ public class DubboBootstrap extends GenericEventListener implements Lifecycle { useRegistryAsConfigCenterIfNecessary(); - initApplicationMetadata(); - initMetadataService(); initMetadataServiceExporter(); @@ -475,11 +450,6 @@ public class DubboBootstrap extends GenericEventListener implements Lifecycle { return this; } - private void initApplicationMetadata() { - String metadataStorageType = getMetadataStorageType(isDefaultMetadataStorageType()); - getApplication().setMetadataStorageType(metadataStorageType); - } - private void startConfigCenter() { Collection configCenters = configManager.getConfigCenters(); @@ -499,7 +469,7 @@ public class DubboBootstrap extends GenericEventListener implements Lifecycle { () -> new IllegalStateException("There's no ApplicationConfig specified.") ); - String metadataType = applicationConfig.getMetadataStorageType(); + String metadataType = applicationConfig.getMetadataType(); // FIXME, multiple metadata config support. Collection metadataReportConfigs = configManager.getMetadataConfigs(); if (CollectionUtils.isEmpty(metadataReportConfigs)) { @@ -589,7 +559,7 @@ public class DubboBootstrap extends GenericEventListener implements Lifecycle { * Initialize {@link MetadataService} from {@link WritableMetadataService}'s extension */ private void initMetadataService() { - this.metadataService = getExtension(isDefaultMetadataStorageType()); + this.metadataService = getExtension(getMetadataType()); } /** @@ -794,7 +764,12 @@ public class DubboBootstrap extends GenericEventListener implements Lifecycle { if (cache == null) { cache = ReferenceConfigCache.getCache(); } - configManager.getReferences().forEach(cache::get); + configManager.getReferences().forEach((rc) -> { + // check eager init or not. + if (rc.shouldInit()) { + cache.get(rc); + } + }); } private void registerServiceInstance() { @@ -843,7 +818,7 @@ public class DubboBootstrap extends GenericEventListener implements Lifecycle { private ServiceInstance createServiceInstance(String serviceName, String host, int port) { this.serviceInstance = new DefaultServiceInstance(serviceName, host, port); - setMetadataStorageType(serviceInstance, isDefaultMetadataStorageType()); + setMetadataStorageType(serviceInstance, getMetadataType()); return this.serviceInstance; } diff --git a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceConsumerBootstrap.java b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceConsumerBootstrap.java index e765643f11..c590653929 100644 --- a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceConsumerBootstrap.java +++ b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceConsumerBootstrap.java @@ -40,7 +40,6 @@ public class DubboServiceConsumerBootstrap { // .registry("consul", builder -> builder.address("consul://127.0.0.1:8500?registry.type=service&subscribed.services=dubbo-provider-demo").group("namespace1")) .reference("echo", builder -> builder.interfaceClass(EchoService.class).protocol("dubbo")) .reference("user", builder -> builder.interfaceClass(UserService.class).protocol("rest")) - .onlyRegisterProvider(true) .start() .await(); diff --git a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceProviderBootstrap.java b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceProviderBootstrap.java index 8dabb16f26..15abaa5bab 100644 --- a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceProviderBootstrap.java +++ b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceProviderBootstrap.java @@ -63,7 +63,7 @@ public class DubboServiceProviderBootstrap { // userService.setRegistries(Arrays.asList(interfaceRegistry, serviceRegistry)); ApplicationConfig applicationConfig = new ApplicationConfig("dubbo-provider-demo"); - applicationConfig.setMetadataStorageType("remote"); + applicationConfig.setMetadataType("remote"); new DubboBootstrap() .application(applicationConfig) // Zookeeper in service registry type diff --git a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/EtcdDubboServiceConsumerBootstrap.java b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/EtcdDubboServiceConsumerBootstrap.java index 01302f3977..b1cc6d39f8 100644 --- a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/EtcdDubboServiceConsumerBootstrap.java +++ b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/EtcdDubboServiceConsumerBootstrap.java @@ -32,7 +32,6 @@ public class EtcdDubboServiceConsumerBootstrap { new DubboBootstrap() .application("dubbo-consumer-demo") - .defaultMetadataStorageType(true) // Zookeeper .protocol(builder -> builder.port(20887).name("dubbo")) .registry("zookeeper", builder -> builder.address("etcd3://127.0.0.1:2379?registry.type=service&subscribed.services=dubbo-provider-demo")) @@ -41,7 +40,6 @@ public class EtcdDubboServiceConsumerBootstrap { // .registry("consul", builder -> builder.address("consul://127.0.0.1:8500?registry.type=service&subscribed.services=dubbo-provider-demo").group("namespace1")) .reference("echo", builder -> builder.interfaceClass(EchoService.class).protocol("dubbo")) .reference("user", builder -> builder.interfaceClass(UserService.class).protocol("rest")) - .onlyRegisterProvider(true) .start() .await(); diff --git a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/EtcdDubboServiceProviderBootstrap.java b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/EtcdDubboServiceProviderBootstrap.java index 013c0d8f23..9a5927348b 100644 --- a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/EtcdDubboServiceProviderBootstrap.java +++ b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/EtcdDubboServiceProviderBootstrap.java @@ -63,10 +63,9 @@ public class EtcdDubboServiceProviderBootstrap { // userService.setRegistries(Arrays.asList(interfaceRegistry, serviceRegistry)); ApplicationConfig applicationConfig = new ApplicationConfig("dubbo-provider-demo"); - applicationConfig.setMetadataStorageType("remote"); + applicationConfig.setMetadataType("remote"); new DubboBootstrap() .application(applicationConfig) - .defaultMetadataStorageType(true) // Zookeeper in service registry type // .registry("zookeeper", builder -> builder.address("zookeeper://127.0.0.1:2181?registry.type=service")) // Nacos diff --git a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/NacosDubboServiceConsumerBootstrap.java b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/NacosDubboServiceConsumerBootstrap.java index 3f577361f8..873457e465 100644 --- a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/NacosDubboServiceConsumerBootstrap.java +++ b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/NacosDubboServiceConsumerBootstrap.java @@ -39,7 +39,6 @@ public class NacosDubboServiceConsumerBootstrap { // .registry("consul", builder -> builder.address("consul://127.0.0.1:8500?registry.type=service&subscribed.services=dubbo-provider-demo").group("namespace1")) .reference("echo", builder -> builder.interfaceClass(EchoService.class).protocol("dubbo")) .reference("user", builder -> builder.interfaceClass(UserService.class).protocol("rest")) - .onlyRegisterProvider(true) .start() .await(); diff --git a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/NacosDubboServiceProviderBootstrap.java b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/NacosDubboServiceProviderBootstrap.java index 2fd8ecbd75..4e0297c991 100644 --- a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/NacosDubboServiceProviderBootstrap.java +++ b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/NacosDubboServiceProviderBootstrap.java @@ -29,7 +29,6 @@ public class NacosDubboServiceProviderBootstrap { public static void main(String[] args) { new DubboBootstrap() - .defaultMetadataStorageType(false) .application("dubbo-provider-demo") // Zookeeper in service registry type .registry("zookeeper", builder -> builder.address("zookeeper://127.0.0.1:2181?registry.type=service")) diff --git a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/compatible/DubboInterfaceConsumerBootstrap.java b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/compatible/DubboInterfaceConsumerBootstrap.java index 79a0030d8b..aa1e74d557 100644 --- a/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/compatible/DubboInterfaceConsumerBootstrap.java +++ b/dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/compatible/DubboInterfaceConsumerBootstrap.java @@ -43,7 +43,6 @@ public class DubboInterfaceConsumerBootstrap { // .registry("consul", builder -> builder.address("consul://127.0.0.1:8500?registry.type=service&subscribed.services=dubbo-provider-demo")) .reference("echo", builder -> builder.interfaceClass(EchoService.class).protocol("dubbo")) .reference("user", builder -> builder.interfaceClass(UserService.class).protocol("rest")) - .onlyRegisterProvider(true) .start() .await(); diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java index 9880c23b40..57b006f3b2 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java @@ -150,7 +150,9 @@ public class ApplicationConfig extends AbstractConfig { /** * Metadata type, local or remote, if choose remote, you need to further specify metadata center. */ - private String metadataStorageType; + private String metadataType; + + private Boolean registerConsumer; public ApplicationConfig() { } @@ -388,12 +390,20 @@ public class ApplicationConfig extends AbstractConfig { return !StringUtils.isEmpty(name); } - public String getMetadataStorageType() { - return metadataStorageType; + public String getMetadataType() { + return metadataType; } - public void setMetadataStorageType(String metadataStorageType) { - this.metadataStorageType = metadataStorageType; + public void setMetadataType(String metadataType) { + this.metadataType = metadataType; + } + + public Boolean getRegisterConsumer() { + return registerConsumer; + } + + public void setRegisterConsumer(Boolean registerConsumer) { + this.registerConsumer = registerConsumer; } @Override diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java index 9d01682318..3169aa8290 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java @@ -490,7 +490,7 @@ public class ReferenceConfig extends AbstractReferenceConfig { return shouldCheck; } - protected boolean shouldInit() { + public boolean shouldInit() { Boolean shouldInit = isInit(); if (shouldInit == null && getConsumer() != null) { shouldInit = getConsumer().isInit(); diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java index f8f56430c7..cd81defe15 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java @@ -160,6 +160,13 @@ public class RegistryConfig extends AbstractConfig { */ private Boolean useAsMetadataCenter; + /** + * list of rpc protocols accepted by this registry, for example, "dubbo,rest" + */ + private String accepts; + + private Boolean preferred; + public RegistryConfig() { } @@ -454,6 +461,22 @@ public class RegistryConfig extends AbstractConfig { this.useAsMetadataCenter = useAsMetadataCenter; } + public String getAccepts() { + return accepts; + } + + public void setAccepts(String accepts) { + this.accepts = accepts; + } + + public Boolean getPreferred() { + return preferred; + } + + public void setPreferred(Boolean preferred) { + this.preferred = preferred; + } + @Override public void refresh() { super.refresh(); diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/builders/ApplicationBuilder.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/builders/ApplicationBuilder.java index 5f6f99992d..b1bb37bd00 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/builders/ApplicationBuilder.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/builders/ApplicationBuilder.java @@ -177,7 +177,7 @@ public class ApplicationBuilder extends AbstractBuilder new IllegalStateException("There's no ApplicationConfig specified.")); + } + // MonitorConfig correlative methods public void setMonitor(MonitorConfig monitor) { diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ApplicationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ApplicationBean.java deleted file mode 100644 index c1d0882dfc..0000000000 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ApplicationBean.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.dubbo.config.spring; - - -import org.apache.dubbo.bootstrap.DubboBootstrap; -import org.apache.dubbo.common.utils.CollectionUtils; -import org.apache.dubbo.config.ApplicationConfig; -import org.apache.dubbo.config.ConfigCenterConfig; -import org.apache.dubbo.config.ConsumerConfig; -import org.apache.dubbo.config.MetadataReportConfig; -import org.apache.dubbo.config.MetricsConfig; -import org.apache.dubbo.config.ModuleConfig; -import org.apache.dubbo.config.MonitorConfig; -import org.apache.dubbo.config.ProtocolConfig; -import org.apache.dubbo.config.ProviderConfig; -import org.apache.dubbo.config.ReferenceConfig; -import org.apache.dubbo.config.RegistryConfig; -import org.apache.dubbo.config.ServiceConfig; -import org.apache.dubbo.config.spring.util.BeanFactoryUtils; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; - -import java.util.List; - -public class ApplicationBean extends ApplicationConfig implements ApplicationListener, ApplicationContextAware { - - private ApplicationContext applicationContext; - - @Override - public void onApplicationEvent(ApplicationEvent event) { - if (event instanceof ContextRefreshedEvent) { - List registries = getBeans(RegistryConfig.class); - List protocols = getBeans(ProtocolConfig.class); - List configs = getBeans(ConfigCenterConfig.class); - List metadatas = getBeans(MetadataReportConfig.class); - List monitors = getBeans(MonitorConfig.class); - List providers = getBeans(ProviderConfig.class); - List consumers = getBeans(ConsumerConfig.class); - List modules = getBeans(ModuleConfig.class); - List metrics = getBeans(MetricsConfig.class); - List services = getBeans(ServiceConfig.class); - List references = getBeans(ReferenceConfig.class); - - DubboBootstrap bootstrap = new DubboBootstrap(); - bootstrap.application(this) - .monitor(CollectionUtils.isNotEmpty(monitors) ? monitors.get(0) : null) - .module(CollectionUtils.isNotEmpty(modules) ? modules.get(0) : null) - .metrics(CollectionUtils.isNotEmpty(metrics) ? metrics.get(0) : null) - .registries(registries) - .protocols(protocols) - .configCenters(configs) - .metadataReports(metadatas) - .providers(providers) - .consumers(consumers) - .services(services) - .references(references) - .start(); - } - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - this.applicationContext = applicationContext; - } - - private List getBeans(Class clazz) { - return BeanFactoryUtils.getBeans(applicationContext, new String[]{""}, clazz); - } -} diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ReferenceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ReferenceBean.java index 586cb22f6b..74edfe8197 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ReferenceBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ReferenceBean.java @@ -75,6 +75,7 @@ public class ReferenceBean extends ReferenceConfig implements FactoryBean, BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ConfigCenterBean.class, false, false); } + // eager init if necessary. if (shouldInit()) { getObject(); } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java index 5e54c25f37..0ae5f62e4d 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/ServiceBean.java @@ -30,10 +30,6 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; - -import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.addApplicationListener; /** * ServiceFactoryBean @@ -41,7 +37,7 @@ import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.addApplicatio * @export */ public class ServiceBean extends ServiceConfig implements InitializingBean, DisposableBean, - ApplicationContextAware, ApplicationListener, BeanNameAware, + ApplicationContextAware, BeanNameAware, ApplicationEventPublisherAware { @@ -53,8 +49,6 @@ public class ServiceBean extends ServiceConfig implements InitializingBean private transient String beanName; - private transient boolean supportedApplicationListener; - private ApplicationEventPublisher applicationEventPublisher; public ServiceBean() { @@ -71,7 +65,6 @@ public class ServiceBean extends ServiceConfig implements InitializingBean public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; SpringExtensionFactory.addApplicationContext(applicationContext); - supportedApplicationListener = addApplicationListener(applicationContext, this); } @Override @@ -88,16 +81,6 @@ public class ServiceBean extends ServiceConfig implements InitializingBean return service; } - @Override - public void onApplicationEvent(ContextRefreshedEvent event) { - if (!isExported() && !isUnexported()) { - if (logger.isInfoEnabled()) { - logger.info("The service ready on spring started. service: " + getInterface()); - } - export(); - } - } - @Override public void afterPropertiesSet() throws Exception { if (StringUtils.isEmpty(getPath())) { @@ -107,9 +90,6 @@ public class ServiceBean extends ServiceConfig implements InitializingBean setPath(beanName); } } - if (!supportedApplicationListener) { - export(); - } } /** diff --git a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd index e926994f75..893cc5e33e 100644 --- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd +++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd @@ -397,11 +397,16 @@ - + + + + + + @@ -590,6 +595,17 @@ + + + + + + + + + + + diff --git a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd index d75b51b32d..e5387517c9 100644 --- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd +++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd @@ -392,11 +392,16 @@ - + + + + + + @@ -584,6 +589,17 @@ + + + + + + + + + + + diff --git a/dubbo-demo/dubbo-demo-interface/src/main/java/org/apache/dubbo/demo/GreetingService.java b/dubbo-demo/dubbo-demo-interface/src/main/java/org/apache/dubbo/demo/GreetingService.java new file mode 100644 index 0000000000..38c7a6072d --- /dev/null +++ b/dubbo-demo/dubbo-demo-interface/src/main/java/org/apache/dubbo/demo/GreetingService.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.demo; + +/** + * + */ +public interface GreetingService { + String hello(); +} diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/pom.xml b/dubbo-demo/dubbo-demo-servicediscovery-xml/pom.xml new file mode 100644 index 0000000000..92c583c93a --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/pom.xml @@ -0,0 +1,61 @@ + + + + + + org.apache.dubbo + dubbo-demo + ${revision} + ../pom.xml + + 4.0.0 + pom + + dubbo-demo-servicediscovery-xml + + + true + 2.1.4.RELEASE + + + + servicediscovery-provider + servicediscovery-consumer + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + repackage + + + + + + + + diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/pom.xml b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/pom.xml new file mode 100644 index 0000000000..7d09428941 --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + + org.apache.dubbo + dubbo-demo-servicediscovery-xml + ${revision} + ../pom.xml + + servicediscovery-consumer + jar + ${project.artifactId} + The demo consumer module of dubbo project + + true + + + + org.apache.dubbo + dubbo-demo-interface + ${project.parent.version} + + + org.apache.dubbo + dubbo-registry-multicast + + + org.apache.dubbo + dubbo-registry-nacos + + + com.alibaba.nacos + nacos-client + + + org.apache.dubbo + dubbo-registry-zookeeper + + + org.apache.dubbo + dubbo-configcenter-zookeeper + + + org.apache.dubbo + dubbo-configcenter-nacos + + + org.apache.dubbo + dubbo-metadata-report-nacos + + + org.apache.dubbo + dubbo-config-spring + + + org.apache.dubbo + dubbo-rpc-dubbo + + + org.apache.dubbo + dubbo-remoting-netty4 + + + org.apache.dubbo + dubbo-serialization-hessian2 + + + diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java new file mode 100644 index 0000000000..f448a184a5 --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.demo.consumer; + +import org.apache.dubbo.demo.DemoService; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Application { + public static void main(String[] args) { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-consumer.xml"); + context.start(); + DemoService demoService = context.getBean("demoService", DemoService.class); + String hello = demoService.sayHello("world"); + System.out.println("result: " + hello); + } +} diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/dubbo.properties b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/dubbo.properties new file mode 100644 index 0000000000..8c3cb2559c --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/dubbo.properties @@ -0,0 +1 @@ +dubbo.application.qos.port=33333 diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/log4j.properties b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/log4j.properties new file mode 100644 index 0000000000..2424381490 --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/log4j.properties @@ -0,0 +1,7 @@ +###set log levels### +log4j.rootLogger=info, stdout +###output to console### +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n \ No newline at end of file diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml new file mode 100644 index 0000000000..d3081f60f0 --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/pom.xml b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/pom.xml new file mode 100644 index 0000000000..61404250d1 --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + org.apache.dubbo + dubbo-demo-servicediscovery-xml + ${revision} + ../pom.xml + + servicediscovery-provider + jar + ${project.artifactId} + The demo provider module of dubbo project + + true + 1.7.25 + + + + + org.apache.dubbo + dubbo-demo-interface + ${project.parent.version} + + + org.apache.dubbo + dubbo-registry-multicast + + + org.apache.dubbo + dubbo-registry-nacos + + + com.alibaba.nacos + nacos-client + + + org.apache.dubbo + dubbo-registry-zookeeper + + + org.apache.dubbo + dubbo-configcenter-zookeeper + + + org.apache.dubbo + dubbo-configcenter-nacos + + + org.apache.dubbo + dubbo-metadata-report-nacos + + + org.apache.dubbo + dubbo-rpc-dubbo + + + org.apache.dubbo + dubbo-config-spring + + + org.apache.dubbo + dubbo-remoting-netty4 + + + org.apache.dubbo + dubbo-serialization-hessian2 + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-log4j12 + ${slf4j-log4j12.version} + + + log4j + log4j + + + diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/java/org/apache/dubbo/demo/provider/Application.java b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/java/org/apache/dubbo/demo/provider/Application.java new file mode 100644 index 0000000000..d1ab5be748 --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/java/org/apache/dubbo/demo/provider/Application.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.demo.provider; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Application { + public static void main(String[] args) throws Exception { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-provider.xml"); + context.start(); + System.in.read(); + } +} diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/java/org/apache/dubbo/demo/provider/DemoServiceImpl.java b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/java/org/apache/dubbo/demo/provider/DemoServiceImpl.java new file mode 100644 index 0000000000..5e2ef2350d --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/java/org/apache/dubbo/demo/provider/DemoServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.demo.provider; + +import org.apache.dubbo.demo.DemoService; +import org.apache.dubbo.rpc.RpcContext; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DemoServiceImpl implements DemoService { + private static final Logger logger = LoggerFactory.getLogger(DemoServiceImpl.class); + + @Override + public String sayHello(String name) { + logger.info("Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress()); + return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); + } + +} diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/dubbo.properties b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/dubbo.properties new file mode 100644 index 0000000000..ad602baa94 --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/dubbo.properties @@ -0,0 +1 @@ +dubbo.application.qos.port=22222 diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/log4j.properties b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/log4j.properties new file mode 100644 index 0000000000..15a0900f0d --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/log4j.properties @@ -0,0 +1,7 @@ +###set log levels### +log4j.rootLogger=info, stdout +###output to the console### +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n \ No newline at end of file diff --git a/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/spring/dubbo-provider.xml b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/spring/dubbo-provider.xml new file mode 100644 index 0000000000..1eaf379133 --- /dev/null +++ b/dubbo-demo/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/spring/dubbo-provider.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + diff --git a/dubbo-demo/pom.xml b/dubbo-demo/pom.xml index 4c03eda7d4..a4dae32b22 100644 --- a/dubbo-demo/pom.xml +++ b/dubbo-demo/pom.xml @@ -35,7 +35,11 @@ dubbo-demo-xml dubbo-demo-annotation dubbo-demo-api + dubbo-demo-servicediscovery-xml + + + diff --git a/dubbo-demo/servicediscovery-transfer/provider/src/main/java/org/apache/dubbo/demo/provider/GreetingServiceImpl.java b/dubbo-demo/servicediscovery-transfer/provider/src/main/java/org/apache/dubbo/demo/provider/GreetingServiceImpl.java new file mode 100644 index 0000000000..af867959f1 --- /dev/null +++ b/dubbo-demo/servicediscovery-transfer/provider/src/main/java/org/apache/dubbo/demo/provider/GreetingServiceImpl.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.demo.provider; + +import org.apache.dubbo.demo.GreetingService; + +/** + * + */ +public class GreetingServiceImpl implements GreetingService { + + @Override + public String hello() { + return "Greetings from server!"; + } + +} diff --git a/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/pom.xml b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/pom.xml new file mode 100644 index 0000000000..dcf6e282c5 --- /dev/null +++ b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + + org.apache.dubbo + servicediscovery-transfer + ${revision} + ../pom.xml + + servicediscovery-consumer + jar + ${project.artifactId} + The demo consumer module of dubbo project + + true + + + + org.apache.dubbo + dubbo-demo-interface + ${project.parent.version} + + + org.apache.dubbo + dubbo-registry-multicast + + + org.apache.dubbo + dubbo-registry-nacos + + + com.alibaba.nacos + nacos-client + + + org.apache.dubbo + dubbo-registry-zookeeper + + + org.apache.dubbo + dubbo-configcenter-zookeeper + + + org.apache.dubbo + dubbo-configcenter-nacos + + + org.apache.dubbo + dubbo-metadata-report-nacos + + + org.apache.dubbo + dubbo-config-spring + + + org.apache.dubbo + dubbo-rpc-dubbo + + + org.apache.dubbo + dubbo-remoting-netty4 + + + org.apache.dubbo + dubbo-serialization-hessian2 + + + diff --git a/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java new file mode 100644 index 0000000000..f448a184a5 --- /dev/null +++ b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.demo.consumer; + +import org.apache.dubbo.demo.DemoService; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Application { + public static void main(String[] args) { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-consumer.xml"); + context.start(); + DemoService demoService = context.getBean("demoService", DemoService.class); + String hello = demoService.sayHello("world"); + System.out.println("result: " + hello); + } +} diff --git a/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/dubbo.properties b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/dubbo.properties new file mode 100644 index 0000000000..8c3cb2559c --- /dev/null +++ b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/dubbo.properties @@ -0,0 +1 @@ +dubbo.application.qos.port=33333 diff --git a/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/log4j.properties b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/log4j.properties new file mode 100644 index 0000000000..2424381490 --- /dev/null +++ b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/log4j.properties @@ -0,0 +1,7 @@ +###set log levels### +log4j.rootLogger=info, stdout +###output to console### +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n \ No newline at end of file diff --git a/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml new file mode 100644 index 0000000000..d3081f60f0 --- /dev/null +++ b/dubbo-demo/servicediscovery-transfer/servicediscovery-consumer/src/main/resources/spring/dubbo-consumer.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/WritableMetadataService.java b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/WritableMetadataService.java index e51fa2a060..67ec3b7885 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/WritableMetadataService.java +++ b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/WritableMetadataService.java @@ -106,20 +106,6 @@ public interface WritableMetadataService extends MetadataService { return getExtensionLoader(WritableMetadataService.class).getDefaultExtension(); } - /** - * Get the metadata's storage type - * - * @param isDefaultStorageType is default storage type or not - * @return non-null, {@link #DEFAULT_METADATA_STORAGE_TYPE "default"} or {@link #REMOTE_METADATA_STORAGE_TYPE "remote"} - */ - public static String getMetadataStorageType(boolean isDefaultStorageType) { - return isDefaultStorageType ? DEFAULT_METADATA_STORAGE_TYPE : REMOTE_METADATA_STORAGE_TYPE; - } - - static WritableMetadataService getExtension(boolean isDefaultStorageType) { - return getExtension(getMetadataStorageType(isDefaultStorageType)); - } - static WritableMetadataService getExtension(String name) { return getExtensionLoader(WritableMetadataService.class).getOrDefaultExtension(name); } diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java index 9367861897..6eab648c95 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java @@ -215,7 +215,7 @@ public class ServiceInstanceMetadataUtils { */ public static String getDefaultMetadataStorageType() { return ConfigManager.getInstance().getApplication() - .map(ApplicationConfig::getMetadataStorageType) + .map(ApplicationConfig::getMetadataType) .orElse(DEFAULT_METADATA_STORAGE_TYPE); } @@ -223,11 +223,11 @@ public class ServiceInstanceMetadataUtils { * Set the metadata storage type in specified {@link ServiceInstance service instance} * * @param serviceInstance {@link ServiceInstance service instance} - * @param isDefaultStorageType is default storage type or not + * @param metadataType remote or local */ - public static void setMetadataStorageType(ServiceInstance serviceInstance, boolean isDefaultStorageType) { + public static void setMetadataStorageType(ServiceInstance serviceInstance, String metadataType) { Map metadata = serviceInstance.getMetadata(); - metadata.put(METADATA_STORAGE_TYPE_KEY, WritableMetadataService.getMetadataStorageType(isDefaultStorageType)); + metadata.put(METADATA_STORAGE_TYPE_KEY, metadataType); } private static void setProviderHostParam(Map params, URL providerURL) {