Skip to content

Commit

Permalink
2.7.8 release (#6403)
Browse files Browse the repository at this point in the history
* Polish #6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection

* Polish #6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection

* Polish #6171 : [Feature] Introducing the composite implementation of MetadataService

* Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)"

This reverts commit 91989ca.

* Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)"

This reverts commit 91989ca.

* Revert the MetadataReport

* Polish #6305 : [Refactor] ServiceConfig and ReferenceConfig publish the ServiceDefinition based on the Dubbo Event

* Polish #6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug

* Polish #6310 : Refactoring MetadataReport's methods

* Polish #6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug

* Polish #6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug

* Polish #6315 : [Refactor] Refactoring the implementation of MetadataReport based on The Config-Center infrastructure

Deprecated List :

- NacosMetadataReport
- ZookeeperMetadataReport

* Polish #6315 : Refactoring by TreePathDynamicConfiguration

* Polish #6315 : Refactoring ConsulDynamicConfiguration by TreePathDynamicConfiguration

* Polish #6315 : Reset the config base path to be "metadata" for ConfigCenterBasedMetadataReportFactory

* Polish #6315 : Bugfix

* Polish #6315 : Bugfix

* Polish #6315 : Correct words

* sync wait netty server to finish shutdown (#6281)

* Polish #6333 : [Refactor] Using mandatory implementation of Service Instance registration instead of the event

* maybe we can remove null judge in this case (#6321)

* update

* update

* Polish #6336 : [Refactor] org.apache.dubbo.metadata.ServiceNameMapping

* Polish #6170 : [Feature] Introducing the externalized configuration for ServiceNameMapping

* Polish #6342 : [Enhancement] Introducing the composite ServiceNameMapping

* Refactor

* fix method name typo in JValidator.java (#6344)

* [Dubbo-6340]fix application cannot exit when use consul registry (#6341)

* fix application cannot exit when use consul registry

* make consul registry suppor ACL (#6313)

* make consul registry suppor ACL

* Polish #6172 : [Feature] Adding the "services" attribute methods into @DubboReference

* Polish #6173 : [Feature] Adding the "services" attribute into <dubbo:reference> element

* Polish #6346 : [Issue] Merging all subscribied URLs from the multiple services

* Polish #6346 : [Issue] Merging all subscribied URLs from the multiple services

* fix publish null value when use consul config center (#6351)

* fix publish null value when use consul config center

* Polish #6252

* Polish #6356 & #6171

* Polish #6356 & #6171

* Polish #6224 : Filter chain was not invoked with local calls since v2.7.6

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : Adding META-INF/dubbo/internal/org.apache.dubbo.metadata.MetadataServiceExporter

* fix the priority of ListenableRouter were not effective (#6148)

fixes #4822

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* when the url is generic, the log level should be info (#6363)

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* fix NPE when check=false is set and provider is empty. (#6376)

fixes #6228

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* fix #6306.  support TypeBuilder sort (#6365)

* fix #6306. support TypeBuilder sort

* fix #6306. support TypeBuilder sort

* fix #6306. support TypeBuilder sort

* remove unused import

* add license for test file

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* enhance ClusterInvoker & ExtensionLoader (#6343)

- Introduce ClusterInvoker to better support multiple registries subscription
- Wrapper sort and enable/disable
- some small fixes

* Polish #6322 : [Enhancement] Fix the issues of test-cases after refactoring

* Fixed the test-cases

* Polish #6389 : [Issue] Resolving the issues with ConsulServiceDiscovery

Co-authored-by: tswstarplanet <tswstarplanet@apache.org>
Co-authored-by: Nine <nine.yang.coding@gmail.com>
Co-authored-by: 陈哈哈 <chenyongjia365@outlook.com>
Co-authored-by: luoning810 <18311333766@163.com>
Co-authored-by: cvictory <shenglicao2@gmail.com>
Co-authored-by: ken.lj <ken.lj.hz@gmail.com>
  • Loading branch information
7 people authored Jul 1, 2020
1 parent 6ae8c0e commit bc48b41
Show file tree
Hide file tree
Showing 29 changed files with 1,297 additions and 976 deletions.
39 changes: 38 additions & 1 deletion dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.USERNAME_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
import static org.apache.dubbo.common.convert.Converter.convertIfPossible;
import static org.apache.dubbo.common.utils.StringUtils.isBlank;

/**
* URL - Uniform Resource Locator (Immutable, ThreadSafe)
Expand Down Expand Up @@ -621,6 +623,41 @@ public List<String> getParameter(String key, List<String> defaultValue) {
return Arrays.asList(strArray);
}

/**
* Get parameter
*
* @param key the key of parameter
* @param valueType the type of parameter value
* @param <T> the type of parameter value
* @return get the parameter if present, or <code>null</code>
* @since 2.7.8
*/
public <T> T getParameter(String key, Class<T> valueType) {
return getParameter(key, valueType, null);
}

/**
* Get parameter
*
* @param key the key of parameter
* @param valueType the type of parameter value
* @param defaultValue the default value if parameter is absent
* @param <T> the type of parameter value
* @return get the parameter if present, or <code>defaultValue</code> will be used.
* @since 2.7.8
*/
public <T> T getParameter(String key, Class<T> valueType, T defaultValue) {
String value = getParameter(key);
T result = null;
if (!isBlank(value)) {
result = convertIfPossible(value, valueType);
}
if (result == null) {
result = defaultValue;
}
return result;
}

private Map<String, Number> getNumbers() {
// concurrent initialization is tolerant
if (numbers == null) {
Expand Down Expand Up @@ -1435,7 +1472,7 @@ public String getColonSeparatedKey() {

private void append(StringBuilder target, String parameterName, boolean first) {
String parameterValue = this.getParameter(parameterName);
if (!StringUtils.isBlank(parameterValue)) {
if (!isBlank(parameterValue)) {
if (!first) {
target.append(":");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,21 @@ default Class<T> getTargetType() {
.findFirst()
.orElse(null);
}

/**
* Convert the value of source to target-type value if possible
*
* @param source the value of source
* @param targetType the target type
* @param <T> the target type
* @return <code>null</code> if can't be converted
* @since 2.7.8
*/
static <T> T convertIfPossible(Object source, Class<T> targetType) {
Converter converter = getConverter(source.getClass(), targetType);
if (converter != null) {
return (T) converter.convert(source);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
*/
package org.apache.dubbo.common.convert.multiple;

import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.common.extension.SPI;
import org.apache.dubbo.common.lang.Prioritized;

import java.util.Collection;

import static org.apache.dubbo.common.extension.ExtensionLoader.getExtensionLoader;
import static org.apache.dubbo.common.utils.TypeUtils.findActualTypeArgument;

/**
Expand Down Expand Up @@ -61,4 +63,30 @@ default Class<S> getSourceType() {
return findActualTypeArgument(getClass(), MultiValueConverter.class, 0);
}

/**
* Find the {@link MultiValueConverter} instance from {@link ExtensionLoader} with the specified source and target type
*
* @param sourceType the source type
* @param targetType the target type
* @return <code>null</code> if not found
* @see ExtensionLoader#getSupportedExtensionInstances()
* @since 2.7.8
*/
static MultiValueConverter<?> find(Class<?> sourceType, Class<?> targetType) {
return getExtensionLoader(MultiValueConverter.class)
.getSupportedExtensionInstances()
.stream()
.filter(converter -> converter.accept(sourceType, targetType))
.findFirst()
.orElse(null);
}

static <T> T convertIfPossible(Object source, Class<?> multiValueType, Class<?> elementType) {
Class<?> sourceType = source.getClass();
MultiValueConverter converter = find(sourceType, multiValueType);
if (converter != null) {
return (T) converter.convert(source, multiValueType, elementType);
}
return null;
}
}
Loading

0 comments on commit bc48b41

Please sign in to comment.