You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2019/07/19 03:01:45 UTC
[dubbo] branch 3.x-dev updated: improve:ReferenceConfig and
ServiceConfig add getServiceMetadata method (#4576)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch 3.x-dev
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.x-dev by this push:
new 8e62405 improve:ReferenceConfig and ServiceConfig add getServiceMetadata method (#4576)
8e62405 is described below
commit 8e624056196a2c5394fb047b1f6a69b7d99bd51d
Author: qinliujie <li...@alibaba-inc.com>
AuthorDate: Fri Jul 19 11:01:33 2019 +0800
improve:ReferenceConfig and ServiceConfig add getServiceMetadata method (#4576)
---
.../main/java/org/apache/dubbo/config/ReferenceConfig.java | 14 +++++++++-----
.../main/java/org/apache/dubbo/config/ServiceConfig.java | 4 ++++
2 files changed, 13 insertions(+), 5 deletions(-)
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 3c64568..552bc4e 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
@@ -76,7 +76,7 @@ public class ReferenceConfig<T> extends AbstractReferenceConfig {
*
* <li>when the url is dubbo://224.5.6.7:1234/org.apache.dubbo.config.api.DemoService?application=dubbo-sample, then
* the protocol is <b>DubboProtocol</b></li>
- *
+ * <p>
* Actually,when the {@link ExtensionLoader} init the {@link Protocol} instants,it will automatically wraps two
* layers, and eventually will get a <b>ProtocolFilterWrapper</b> or <b>ProtocolListenerWrapper</b>
*/
@@ -277,12 +277,11 @@ public class ReferenceConfig<T> extends AbstractReferenceConfig {
serviceMetadata.setVersion(version);
serviceMetadata.setGroup(group);
serviceMetadata.setDefaultGroup(group);
- serviceMetadata.setServiceType(interfaceClass);
+ serviceMetadata.setServiceType(getActualInterface());
serviceMetadata.setServiceInterfaceName(interfaceName);
-
- ConsumerModel consumerModel = new ConsumerModel(interfaceName, group, version, getActualInterface());
+ ConsumerModel consumerModel = new ConsumerModel(serviceMetadata);
ApplicationModel.initConsumerModel(URL.buildKey(interfaceName, group, version), consumerModel);
@@ -353,6 +352,7 @@ public class ReferenceConfig<T> extends AbstractReferenceConfig {
}
return actualInterface;
}
+
@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
private T createProxy(Map<String, String> map) {
if (shouldJvmRefer(map)) {
@@ -464,7 +464,7 @@ public class ReferenceConfig<T> extends AbstractReferenceConfig {
protected boolean shouldCheck() {
Boolean shouldCheck = isCheck();
- if (shouldCheck == null && getConsumer()!= null) {
+ if (shouldCheck == null && getConsumer() != null) {
shouldCheck = getConsumer().isCheck();
}
if (shouldCheck == null) {
@@ -634,6 +634,10 @@ public class ReferenceConfig<T> extends AbstractReferenceConfig {
return invoker;
}
+ public ServiceMetadata getServiceMetadata() {
+ return serviceMetadata;
+ }
+
@Override
@Parameter(excluded = true)
public String getPrefix() {
diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
index 953bef1..ba3dd79 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
@@ -1001,6 +1001,10 @@ public class ServiceConfig<T> extends AbstractServiceConfig {
return urls;
}
+ public ServiceMetadata getServiceMetadata() {
+ return serviceMetadata;
+ }
+
/**
* @deprecated Replace to getProtocols()
*/