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/11/03 05:34:43 UTC
[dubbo] 11/12: Merge branch 'merge-3.x'
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
commit 1090348566dd5afd1f5a03477ccc3120167bd639
Merge: cea3de7 e826d08
Author: ken.lj <ke...@gmail.com>
AuthorDate: Thu Oct 31 16:33:21 2019 +0800
Merge branch 'merge-3.x'
# Conflicts:
# dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
# dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ServiceMetadata.java
# dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/Offline.java
# dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/Online.java
# dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/LsTest.java
# dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OfflineTest.java
# dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/command/impl/OnlineTest.java
# dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcInvocation.java
# dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/GenericImplFilter.java
.../org/apache/dubbo/common/ServiceDescriptor.java | 94 ++++++++++++++++++++++
.../src/main/java/org/apache/dubbo/common/URL.java | 16 +---
.../common/config/OrderedPropertiesProvider.java | 5 ++
.../dubbo/common/extension/ExtensionLoader.java | 39 +++++----
.../apache/dubbo/rpc/model/ServiceMetadata.java | 45 ++---------
.../dubbo/qos/command/impl/TestInterface.java | 9 +++
.../dubbo/qos/command/impl/TestInterface2.java | 9 +++
.../main/java/org/apache/dubbo/rpc/Invocation.java | 12 +++
.../org/apache/dubbo/rpc/support/RpcUtils.java | 3 +
9 files changed, 166 insertions(+), 66 deletions(-)
diff --cc dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
index b6429d6,6a34fdd..cbe358c
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
@@@ -407,30 -339,6 +407,18 @@@ class URL implements Serializable
}
}
+ static String appendDefaultPort(String address, int defaultPort) {
+ if (address != null && address.length() > 0 && defaultPort > 0) {
+ int i = address.indexOf(':');
+ if (i < 0) {
+ return address + ":" + defaultPort;
+ } else if (Integer.parseInt(address.substring(i + 1)) == 0) {
+ return address.substring(0, i + 1) + defaultPort;
+ }
+ }
+ return address;
+ }
+
- public static String buildKey(String path, String group, String version) {
- StringBuilder buf = new StringBuilder();
- if (group != null && group.length() > 0) {
- buf.append(group).append("/");
- }
- buf.append(path);
- if (version != null && version.length() > 0) {
- buf.append(":").append(version);
- }
- return buf.toString();
- }
-
public String getProtocol() {
return protocol;
}
diff --cc dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ServiceMetadata.java
index f917ac1,0000000..5275030
mode 100644,000000..100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ServiceMetadata.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ServiceMetadata.java
@@@ -1,137 -1,0 +1,102 @@@
+/*
+ * 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.rpc.model;
+
- import org.apache.dubbo.common.utils.StringUtils;
++import org.apache.dubbo.common.ServiceDescriptor;
++import org.apache.dubbo.common.URL;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Notice, this class currently has no usage inside Dubbo.
+ *
+ * data related to service level such as name, version, classloader of business service,
+ * security info, etc. Also with a AttributeMap for extension.
+ */
- public class ServiceMetadata {
++public class ServiceMetadata extends ServiceDescriptor {
+
- private String serviceKey;
- private String serviceInterfaceName;
+ private String defaultGroup;
- private String version;
+ private Class<?> serviceType;
+
- private volatile String group;
-
+ private Object target;
+
+ /* will be transferred to remote side */
+ private final Map<String, Object> attachments = new ConcurrentHashMap<String, Object>();
+ /* used locally*/
+ private final Map<String, Object> attributeMap = new ConcurrentHashMap<String, Object>();
+
+ public ServiceMetadata(String serviceInterfaceName, String group, String version, Class<?> serviceType) {
+ this.serviceInterfaceName = serviceInterfaceName;
+ this.defaultGroup = group;
+ this.group = group;
+ this.version = version;
- this.serviceKey = serviceInterfaceName + ":" + version;
++ this.serviceKey = URL.buildKey(serviceInterfaceName, group, version);
+ this.serviceType = serviceType;
+ }
+
+ public ServiceMetadata() {
+ }
+
+ public String getServiceKey() {
- if (StringUtils.isNotEmpty(serviceKey)) {
- return serviceKey;
- }
- return serviceInterfaceName + ":" + version;
++ return serviceKey;
+ }
+
+ public Map<String, Object> getAttachments() {
+ return attachments;
+ }
+
+ public Map<String, Object> getAttributeMap() {
+ return attributeMap;
+ }
+
+ public Object getAttribute(String key) {
+ return attributeMap.get(key);
+ }
+
+ public void addAttribute(String key, Object value) {
+ this.attributeMap.put(key, value);
+ }
+
+ public void addAttachment(String key, Object value) {
+ this.attributeMap.put(key, value);
+ }
+
+ public Class<?> getServiceType() {
+ return serviceType;
+ }
+
- public String getServiceInterfaceName() {
- return serviceInterfaceName;
- }
-
+ public String getDefaultGroup() {
+ return defaultGroup;
+ }
+
- public String getVersion() {
- return version;
- }
-
- public String getGroup() {
- return group;
- }
-
- public void setGroup(String group) {
- this.group = group;
- }
-
- public void setServiceInterfaceName(String serviceInterfaceName) {
- this.serviceInterfaceName = serviceInterfaceName;
- }
-
+ public void setDefaultGroup(String defaultGroup) {
+ this.defaultGroup = defaultGroup;
+ }
+
- public void setVersion(String version) {
- this.version = version;
- }
-
+ public void setServiceType(Class<?> serviceType) {
+ this.serviceType = serviceType;
+ }
+
- public void setServiceKey(String serviceKey) {
- this.serviceKey = serviceKey;
- }
-
+ public Object getTarget() {
+ return target;
+ }
+
+ public void setTarget(Object target) {
+ this.target = target;
+ }
+}