Skip to content

Commit

Permalink
2.7.8 Rlease (#6398)
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

* 2.7.8 service introspection (#6300)

* 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

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

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

* 2.7.8 service introspection update (#6308)

* 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 #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

* 2.7.8 service introspection (#6317)

* 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

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

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

* 2.7.8 service introspection (#6337)

* 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

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

* 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

* 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

* 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

* 2.7.8 service introspection (#6366)

* 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

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

* 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

* 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

* 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

* 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

* 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

* 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

* 2.7.8 Test Cases (#6384)

* Polish #6152

* Polish #6174 : [Enhancement] Registering the common beans for Spring XML meta-configuration

* Polish #6174 : Fixing the test-cases

* Polish #6174 : Fixing the test-cases

* Add the test-case for multiple services with MethodConfigs

* Fixed the test-cases

* 2.7.8 Dev (#6386)

* 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

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>

* Fixes the issue of merging code in Github

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

* Fixes the test-cases

* Fixes the test-cases

* Fixes the test-cases

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 committed Jul 2, 2020
1 parent 51361d5 commit 4aaaea4
Show file tree
Hide file tree
Showing 193 changed files with 6,842 additions and 3,134 deletions.
8 changes: 8 additions & 0 deletions dubbo-all/pom.xml
Expand Up @@ -981,6 +981,14 @@
</resource>
</transformer>

<!-- @since 2.7.8 -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>
META-INF/dubbo/internal/org.apache.dubbo.metadata.MetadataServiceExporter
</resource>
</transformer>

</transformers>
<filters>
<filter>
Expand Down
Expand Up @@ -27,9 +27,9 @@
import java.util.Map;
import java.util.Optional;

import static org.apache.dubbo.rpc.cluster.Constants.PRIORITY_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL;
import static org.apache.dubbo.rpc.cluster.Constants.PRIORITY_KEY;

/**
* Configurator. (SPI, Prototype, ThreadSafe)
Expand Down
59 changes: 58 additions & 1 deletion dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
Expand Up @@ -35,10 +35,12 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;

import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE;
Expand All @@ -55,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 @@ -566,6 +570,24 @@ public Map<String, String> getParameters() {
return parameters;
}

/**
* Get the parameters to be selected(filtered)
*
* @param nameToSelect the {@link Predicate} to select the parameter name
* @return non-null {@link Map}
* @since 2.7.8
*/
public Map<String, String> getParameters(Predicate<String> nameToSelect) {
Map<String, String> selectedParameters = new LinkedHashMap<>();
for (Map.Entry<String, String> entry : getParameters().entrySet()) {
String name = entry.getKey();
if (nameToSelect.test(name)) {
selectedParameters.put(name, entry.getValue());
}
}
return Collections.unmodifiableMap(selectedParameters);
}

public Map<String, Map<String, String>> getMethodParameters() {
return methodParameters;
}
Expand Down Expand Up @@ -601,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 @@ -1415,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
Expand Up @@ -20,13 +20,17 @@
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.NamedThreadFactory;
import org.apache.dubbo.common.utils.StringUtils;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;

/**
* The abstract implementation of {@link DynamicConfiguration}
*
Expand All @@ -47,6 +51,20 @@ public abstract class AbstractDynamicConfiguration implements DynamicConfigurati
*/
public static final String THREAD_POOL_KEEP_ALIVE_TIME_PARAM_NAME = PARAM_NAME_PREFIX + "thread-pool.keep-alive-time";

/**
* The parameter name of group for config-center
*
* @since 2.7.8
*/
public static final String GROUP_PARAM_NAME = PARAM_NAME_PREFIX + GROUP_KEY;

/**
* The parameter name of timeout for config-center
*
* @since 2.7.8
*/
public static final String TIMEOUT_PARAM_NAME = PARAM_NAME_PREFIX + TIMEOUT_KEY;

public static final int DEFAULT_THREAD_POOL_SIZE = 1;

/**
Expand All @@ -64,28 +82,31 @@ public abstract class AbstractDynamicConfiguration implements DynamicConfigurati
*/
private final ThreadPoolExecutor workersThreadPool;

public AbstractDynamicConfiguration() {
this(DEFAULT_THREAD_POOL_PREFIX, DEFAULT_THREAD_POOL_SIZE, DEFAULT_THREAD_POOL_KEEP_ALIVE_TIME);
}
private final String group;

private final long timeout;

public AbstractDynamicConfiguration(URL url) {
this(getThreadPoolPrefixName(url), getThreadPoolSize(url), getThreadPoolKeepAliveTime(url));
this(getThreadPoolPrefixName(url), getThreadPoolSize(url), getThreadPoolKeepAliveTime(url), getGroup(url),
getTimeout(url));
}

public AbstractDynamicConfiguration(String threadPoolPrefixName,
int threadPoolSize,
long keepAliveTime) {
long keepAliveTime,
String group,
long timeout) {
this.workersThreadPool = initWorkersThreadPool(threadPoolPrefixName, threadPoolSize, keepAliveTime);
this.group = group;
this.timeout = timeout;
}

@Override
public void addListener(String key, String group, ConfigurationListener listener) {

}

@Override
public void removeListener(String key, String group, ConfigurationListener listener) {

}

@Override
Expand All @@ -107,6 +128,29 @@ public final void close() throws Exception {
}
}

@Override
public boolean removeConfig(String key, String group) {
return execute(() -> doRemoveConfig(key, group), -1L);
}

/**
* @return the default group
* @since 2.7.8
*/
@Override
public String getDefaultGroup() {
return getGroup();
}

/**
* @return the default timeout
* @since 2.7.8
*/
@Override
public long getDefaultTimeout() {
return getTimeout();
}

/**
* Get the content of configuration in the specified key and group
*
Expand All @@ -124,6 +168,17 @@ public final void close() throws Exception {
*/
protected abstract void doClose() throws Exception;

/**
* Remove the config in the specified key and group
*
* @param key the key
* @param group the group
* @return If successful, return <code>true</code>, or <code>false</code>
* @throws Exception
* @since 2.7.8
*/
protected abstract boolean doRemoveConfig(String key, String group) throws Exception;

/**
* Executes the {@link Runnable} with the specified timeout
*
Expand Down Expand Up @@ -181,7 +236,7 @@ protected ThreadPoolExecutor initWorkersThreadPool(String threadPoolPrefixName,
int threadPoolSize,
long keepAliveTime) {
return new ThreadPoolExecutor(threadPoolSize, threadPoolSize, keepAliveTime,
TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory(threadPoolPrefixName));
TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory(threadPoolPrefixName, true));
}

protected static String getThreadPoolPrefixName(URL url) {
Expand Down Expand Up @@ -216,4 +271,36 @@ protected static long getParameter(URL url, String name, long defaultValue) {
}
return defaultValue;
}


protected String getGroup() {
return group;
}

protected long getTimeout() {
return timeout;
}

/**
* Get the group from {@link URL the specified connection URL}
*
* @param url {@link URL the specified connection URL}
* @return non-null
* @since 2.7.8
*/
protected static String getGroup(URL url) {
String group = getParameter(url, GROUP_PARAM_NAME, null);
return StringUtils.isBlank(group) ? getParameter(url, GROUP_KEY, DEFAULT_GROUP) : group;
}

/**
* Get the timeout from {@link URL the specified connection URL}
*
* @param url {@link URL the specified connection URL}
* @return non-null
* @since 2.7.8
*/
protected static long getTimeout(URL url) {
return getParameter(url, TIMEOUT_PARAM_NAME, -1L);
}
}
Expand Up @@ -35,7 +35,7 @@ public abstract class AbstractDynamicConfigurationFactory implements DynamicConf

@Override
public final DynamicConfiguration getDynamicConfiguration(URL url) {
String key = url == null ? DEFAULT_KEY : url.getAddress();
String key = url == null ? DEFAULT_KEY : url.toServiceString();
return dynamicConfigurations.computeIfAbsent(key, k -> createDynamicConfiguration(url));
}

Expand Down
Expand Up @@ -232,4 +232,14 @@ static DynamicConfiguration getDynamicConfiguration(URL connectionURL) {
static String getRuleKey(URL url) {
return url.getColonSeparatedKey();
}

/**
* @param key the key to represent a configuration
* @param group the group where the key belongs to
* @return <code>true</code> if success, or <code>false</code>
* @since 2.7.8
*/
default boolean removeConfig(String key, String group) {
return true;
}
}

0 comments on commit 4aaaea4

Please sign in to comment.