Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dubbo cloud native #5008

Merged
merged 146 commits into from
Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
f51b394
Polish apache/dubbo#4542 : [Enhancement] Adapt the Java standard Even…
mercyblitz Jul 11, 2019
9e58caa
Polish apache/dubbo#4541 : [Feature] Add local File System DynamicCon…
mercyblitz Jul 15, 2019
9252be1
Polish apache#4541 : Bugfix
mercyblitz Jul 15, 2019
08089b6
Polish apache/dubbo#4541 : Optimization
mercyblitz Jul 15, 2019
cdd9338
Polish apache/dubbo#4541 : Add the compatibility for PollingWatchServ…
mercyblitz Jul 16, 2019
f0408f7
Polish apache/dubbo#4541 : Add delay publish without ThreadPoolExecutor
mercyblitz Jul 16, 2019
5f354a0
Polish apache/dubbo#4541 : Refactor the extension name
mercyblitz Jul 17, 2019
8152a75
Polish apache/dubbo#4541 : Add remove ops
mercyblitz Jul 17, 2019
df1a258
Polish apache/dubbo#4541 : Add testable constructor
mercyblitz Jul 17, 2019
52c0205
Polish apache/dubbo#4541 : Add getConfigGroups method
mercyblitz Jul 17, 2019
293a70d
Polish apache/dubbo#4610 : [Refactor] Refactor the bootstrap module
mercyblitz Jul 20, 2019
3218a1f
Polish apache/dubbo#4541 : Fix the nulling URL issue
mercyblitz Jul 20, 2019
d5c78ac
Polish apache/dubbo#4622 : [Refactor] Refactor ConfigManager
mercyblitz Jul 25, 2019
1d54a1d
Polish apache/dubbo#4622 : [Refactor] Refactor ConfigManager
mercyblitz Jul 25, 2019
5071a04
Polish apache/dubbo#4622 : Support multiple configcenters
mercyblitz Jul 26, 2019
ccf614c
Polish apache/dubbo#4671 : ServiceNameMapping will not map the group,…
mercyblitz Jul 26, 2019
87e88e2
update referenceCount log (#4683)
haiyang1985 Jul 29, 2019
5d299af
Polish /apache/dubbo#4687 : Remove the duplicated test code in dubbo-…
mercyblitz Jul 29, 2019
25ec31e
#4685 修改代码if判断false问题 if (hasException == false)修改成if (!hasException…
smipo Jul 30, 2019
c3132b8
Fixed Service annotation method parameters are not in effect (#4598)
Leishunyu Jul 31, 2019
f490df8
keep demo simple, and switch to use zookeeper as registry center (#4705)
beiwei30 Jul 31, 2019
c8dbd7d
@Reference auto-wires the instance of generic interface #4594 (#4677)
CodingSinger Jul 31, 2019
65a0140
try to shorten maven output to make travis build pass (#4710)
beiwei30 Aug 1, 2019
5b38331
use CountDownLatch to check zk registry if establish connection (#4589)
tswstarplanet Aug 1, 2019
a646874
Minor change
mercyblitz Aug 1, 2019
b8e601a
Merge remote-tracking branch 'upstream/master' into dubbo-cloud-native
mercyblitz Aug 2, 2019
0644fe1
Rename the extension name of WritableMetadataService
mercyblitz Aug 5, 2019
9f405d7
Polish apache/dubbo#4759 : [Refactor] Change the signature of methods…
mercyblitz Aug 7, 2019
a344121
Merge remote-tracking branch 'upstream/master' into dubbo-cloud-native
mercyblitz Aug 7, 2019
8c7f37a
Polish apache/dubbo#3984 : Add the implementation of Page<ServiceInst…
mercyblitz Aug 7, 2019
2a88323
Code merge
mercyblitz Aug 7, 2019
240c456
Code merge
mercyblitz Aug 8, 2019
391d053
Fix the cases
mercyblitz Aug 8, 2019
3e57a0a
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 8, 2019
83fc425
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 8, 2019
a147829
Refactor ConfigManager
mercyblitz Aug 12, 2019
eea35ce
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 12, 2019
e307e98
Refactor ConfigManager
mercyblitz Aug 12, 2019
f84a33d
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 12, 2019
ad3e638
Resolve the issues on ConfigManager
mercyblitz Aug 12, 2019
19f1474
Resolve conflict
mercyblitz Aug 12, 2019
07cf7b1
Refactor and add test-cases for ConfigManager
mercyblitz Aug 13, 2019
b4bf6ba
Merge branch 'cloud-native' into dubbo-cloud-native
mercyblitz Aug 13, 2019
a7088ef
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 13, 2019
df9ff69
Merge remote-tracking branch 'origin/dubbo-cloud-native' into dubbo-c…
mercyblitz Aug 13, 2019
51d2be4
Polish apache/dubbo#4774 : [Feature] Dubbo Cloud Native - To Support …
mercyblitz Aug 13, 2019
c284dad
Polish apache/dubbo#4808 : [Feature] Add the registered/unregistered …
mercyblitz Aug 13, 2019
3d84c35
Polish apache/dubbo#4807 : [Feature] Add the callback mechanism Shutd…
mercyblitz Aug 13, 2019
21bcfaa
Polish apache/dubbo#4813 : [Feature] add Prioritized implementation f…
mercyblitz Aug 13, 2019
63a315c
Polish apache/dubbo#4815 : [Feature] Add the ServiceLoader for Dubbo'…
mercyblitz Aug 14, 2019
741321c
Polish apache/dubbo#4815 : [Feature] Add the ServiceLoader for Dubbo'…
mercyblitz Aug 14, 2019
70f9de2
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 14, 2019
16c77fc
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 14, 2019
d448ab6
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 14, 2019
1ac1ad7
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 15, 2019
f67d769
Polish apache/dubbo#4813 : [Feature] add Prioritized implementation f…
mercyblitz Aug 15, 2019
b286e1d
Polish apache/dubbo#4807 : Add sort implementation
mercyblitz Aug 15, 2019
9f6e79e
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 15, 2019
0bfda83
Refactor
mercyblitz Aug 15, 2019
b5da5da
Refactor
mercyblitz Aug 16, 2019
8a7f52b
Polish apache/dubbo#4845 : [Feature] Enhance the Event-Publishing fea…
mercyblitz Aug 16, 2019
4a43d0c
Merge branch 'cloud-native' into dubbo-cloud-native
mercyblitz Aug 16, 2019
f50eed8
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 16, 2019
c70f55b
Merge remote-tracking branch 'origin/dubbo-cloud-native' into dubbo-c…
mercyblitz Aug 16, 2019
176d56b
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 16, 2019
49de00e
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 16, 2019
147c477
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 16, 2019
3fb793a
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 16, 2019
39fca05
Polish apache/dubbo#4854 : [Feature] MetadataService supports the Dub…
mercyblitz Aug 16, 2019
1f749cf
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 16, 2019
4ef7e30
Polish apache/dubbo#4857 : [Enhancement] Sync the Metadata storage ty…
mercyblitz Aug 16, 2019
21af756
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 16, 2019
64c3425
Polish apache/dubbo#4868 : [Enhancement] Refactor ConfigChangeEvent
mercyblitz Aug 19, 2019
940452e
Polish apache/dubbo#4868 : [Enhancement] Refactor ConfigChangeEvent
mercyblitz Aug 19, 2019
f676f5e
Polish apache/dubbo#4873 : [Feature] Add a conditional EventListener …
mercyblitz Aug 19, 2019
4356c52
Polish apache/dubbo#4875 : [Feature] Refactor ServiceInstancesChanged…
mercyblitz Aug 19, 2019
839c4c1
Remove the cycle dependencies
mercyblitz Aug 21, 2019
c30545c
Remove the cycle dependencies
mercyblitz Aug 21, 2019
193a751
Merge branch 'cloud-native' into dubbo-cloud-native
mercyblitz Aug 21, 2019
5ddf7b3
Polish apache/dubbo#4903 : [Feature] Set source into the BeanDefiniti…
mercyblitz Aug 21, 2019
2992d59
Merge remote-tracking branch 'origin/dubbo-cloud-native' into dubbo-c…
mercyblitz Aug 21, 2019
5b8b3f5
Polish apache/dubbo#4902 : [Feature] Dubbo Cloud Native to Spring XML…
mercyblitz Aug 21, 2019
8d11685
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 21, 2019
024e275
Polish apache/dubbo#4713 : Initial the new module and dependencies
mercyblitz Aug 21, 2019
f3925f5
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 21, 2019
e819462
Polish apache/dubbo#4690 : AnnotatedBeanDefinitionRegistryUtils#regis…
mercyblitz Aug 21, 2019
46999e1
Polish apache/dubbo#4690 : AnnotatedBeanDefinitionRegistryUtils#regis…
mercyblitz Aug 21, 2019
9c46d74
Polish apache/dubbo#4690 : AnnotatedBeanDefinitionRegistryUtils#regis…
mercyblitz Aug 21, 2019
492bc64
Polish apache/dubbo#4910 : [Feature] To suppoort DubboLifecycleCompon…
mercyblitz Aug 21, 2019
32365e8
Polish apache/dubbo#4713 : Add Service discovery implementation for E…
mercyblitz Aug 21, 2019
b992436
Polish apache/dubbo#4713 : Add Service registration and discovery imp…
mercyblitz Aug 22, 2019
072ecc7
Polish apache/dubbo#4713 : Add Service registration and discovery imp…
mercyblitz Aug 22, 2019
13b2b8b
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 23, 2019
f97802c
Polish apache/dubbo#4920 : [Refactor] Extract the common implementati…
mercyblitz Aug 23, 2019
15f86c9
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 23, 2019
f88d582
Refactor
mercyblitz Aug 23, 2019
6960889
Merge branch 'cloud-native' into dubbo-cloud-native
mercyblitz Aug 23, 2019
6809cf9
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 23, 2019
9382994
Polish apache/dubbo#4925 : ServiceDiscovery limits only one ServiceIn…
mercyblitz Aug 23, 2019
e9185f5
Merge remote-tracking branch 'origin/dubbo-cloud-native' into dubbo-c…
mercyblitz Aug 23, 2019
91250a4
Polish apache/dubbo#4925 : ServiceDiscovery limits only one ServiceIn…
mercyblitz Aug 23, 2019
a85fee5
Remove useless classes
mercyblitz Aug 23, 2019
92c2a54
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 23, 2019
641023f
Bugfix & Refactor ServiceDiscoveryRegistry
mercyblitz Aug 25, 2019
940b92f
Merge branch 'cloud-native' into dubbo-cloud-native
mercyblitz Aug 25, 2019
f2b2d50
Polish apache/dubbo#4937 : The calculation of Revision should add the…
mercyblitz Aug 26, 2019
75939d2
Merge remote-tracking branch 'origin/dubbo-cloud-native' into dubbo-c…
mercyblitz Aug 26, 2019
a15ea1a
Polish apache/dubbo#4940 : NacosDynamicConfiguration supports getConf…
mercyblitz Aug 26, 2019
c9cb169
Polish apache/dubbo#4942 : Dubbo Cloud Native supports multiple protcols
mercyblitz Aug 26, 2019
0d85904
Merge branch 'cloud-native' into dubbo-cloud-native
mercyblitz Aug 26, 2019
4a9e514
Polish apache/dubbo#4944 : [Feature] Simplify The metadata of URL for…
mercyblitz Aug 26, 2019
93a1288
Merge remote-tracking branch 'origin/dubbo-cloud-native' into dubbo-c…
mercyblitz Aug 26, 2019
3ec0aea
Merge branch 'cloud-native' into dubbo-cloud-native
mercyblitz Aug 26, 2019
72ab094
Polish apache/dubbo#4947 : [Feature] Dubbo Cloud-Native supports the …
mercyblitz Aug 26, 2019
e13fd62
Merge remote-tracking branch 'origin/dubbo-cloud-native' into dubbo-c…
mercyblitz Aug 26, 2019
d3eab7e
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 27, 2019
88bd2cf
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 27, 2019
8154933
Refactor
mercyblitz Aug 27, 2019
a5ac4ff
Update JavaDoc
mercyblitz Aug 28, 2019
8088dd2
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Aug 28, 2019
b14ad94
Polish apache/dubbo#4905 : Add test cases for Configuration
mercyblitz Aug 29, 2019
919b221
Polish apache/dubbo#4905 : Add test cases for AbstractDynamicConfigur…
mercyblitz Aug 29, 2019
75de8ff
Polish apache/dubbo#4905 : Add test cases for ConfigChangeType
mercyblitz Aug 29, 2019
b70399c
Polish apache/dubbo#4905 : Add test cases for AbstractDynamicConfigur…
mercyblitz Aug 29, 2019
e2f74f9
Polish apache/dubbo#4905 : Add test cases for ConfigChangedEvent
mercyblitz Aug 29, 2019
b3c9c54
Polish apache/dubbo#4905 : Add test cases for ConfigChangedEvent
mercyblitz Aug 29, 2019
5d0b4f8
Polish apache/dubbo#4905 : Add test cases for FileSystemDynamicConfig…
mercyblitz Aug 29, 2019
c86bdce
Polish apache/dubbo#4905 : Add test cases for FileSystemDynamicConfig…
mercyblitz Aug 29, 2019
295708c
Polish apache/dubbo#4905 : Enhancement the robustness for FileSystemD…
mercyblitz Aug 29, 2019
383c559
Polish apache/dubbo#4905 : Add test cases for AdaptiveClassCodeGenerator
mercyblitz Sep 2, 2019
628e0fc
Polish apache/dubbo#4905 : Add test cases for ExtensionLoader
mercyblitz Sep 2, 2019
7449f73
Polish apache/dubbo#4905 : Add test cases for ThrowableAction, Throwa…
mercyblitz Sep 2, 2019
35d32c5
Polish apache/dubbo#4905 : Add test cases for Prioritized
mercyblitz Sep 2, 2019
eb143c3
Polish apache/dubbo#4905 : Add test cases for ShutdownHookCallbacks
mercyblitz Sep 2, 2019
948dfa6
Polish apache/dubbo#4905 : Add test cases for DubboServiceLoader
mercyblitz Sep 2, 2019
59a416c
Polish apache/dubbo#4981 : Add dubbo-common
mercyblitz Sep 2, 2019
3503023
Polish apache/dubbo#4907 : Add test cases for DubboServiceDestroyedEvent
mercyblitz Sep 3, 2019
b21e7ba
Polish apache/dubbo#4907 : Add test cases for DubboShutdownHookRegist…
mercyblitz Sep 3, 2019
cfc1bda
Polish apache/dubbo#4907 : Add test cases for DubboShutdownHookUnregi…
mercyblitz Sep 3, 2019
7bdcb5b
Polish apache/dubbo#4907 : Add test cases for ReferenceConfigDestroye…
mercyblitz Sep 3, 2019
a254d7c
Polish apache/dubbo#4907 : Add test cases for ReferenceConfigInitiali…
mercyblitz Sep 3, 2019
8e847e4
Polish apache/dubbo#4907 : Add test cases for ServiceInstancePortCust…
mercyblitz Sep 3, 2019
45d629e
Polish apache/dubbo#4907 : Add test cases for ConfigurableMetadataSer…
mercyblitz Sep 3, 2019
c4bc04b
Polish apache/dubbo#4907 : bugfix for @EnableDubbo
mercyblitz Sep 3, 2019
872a07f
Polish apache/dubbo#4907 : add test cases for @EnableDubboLifecycle
mercyblitz Sep 5, 2019
4bdbe68
Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud…
mercyblitz Sep 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions dubbo-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,15 @@
</includes>
</artifactSet>
<transformers>
<!-- dubbo-common beginning -->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.common.compiler.Compiler
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.compiler.Compiler
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.config.configcenter.DynamicConfigurationFactory
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
Expand All @@ -692,15 +699,34 @@
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.infra.InfraAdapter
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.logger.LoggerAdapter
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.common.status.StatusChecker
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.status.StatusChecker
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.common.threadpool.ThreadPool
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.store.DataStore
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.threadpool.ThreadPool
</resource>
</transformer>
<!-- dubbo-common end -->

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.common.serialize.Serialization
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
Expand Down Expand Up @@ -784,22 +810,10 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.cache.CacheFactory</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.common.store.DataStore
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.common.logger.LoggerAdapter
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.qos.command.BaseCommand
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.common.config.configcenter.DynamicConfigurationFactory
</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/dubbo/internal/org.apache.dubbo.metadata.report.MetadataReportFactory
</resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.dubbo.common.utils.StringUtils;
import org.apache.dubbo.common.utils.UrlUtils;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ConfigCenterConfig;
import org.apache.dubbo.config.ConsumerConfig;
Expand Down Expand Up @@ -602,6 +603,11 @@ private Collection<ServiceDiscovery> getServiceDiscoveries() {
*/
@Override
public DubboBootstrap start() {

if (!shouldStart()) {
return this;
}

if (!isInitialized()) {
initialize();
}
Expand Down Expand Up @@ -632,6 +638,22 @@ public DubboBootstrap start() {
return this;
}

/**
* Should Start current bootstrap
*
* @return If there is not any service discovery registry in the {@link ConfigManager#getRegistries()}, it will not
* start current bootstrap
*/
private boolean shouldStart() {
return configManager.getRegistries()
.stream()
.map(RegistryConfig::getAddress)
.map(URL::valueOf)
.filter(UrlUtils::isServiceDiscoveryRegistryType)
.count() > 0;
}


private boolean hasExportedServices() {
return !metadataService.getExportedURLs().isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void main(String[] args) {
.application("zookeeper-dubbo-provider")
.registry(builder -> builder.address("zookeeper://127.0.0.1:2181?registry-type=service"))
.protocol("dubbo", builder -> builder.port(-1).name("dubbo"))
.protocol("rest", builder -> builder.port(8082).name("rest"))
.protocol("rest", builder -> builder.port(8081).name("rest"))
.service("echo", builder -> builder.interfaceClass(EchoService.class).ref(new EchoServiceImpl()).protocolIds("dubbo"))
.service("user", builder -> builder.interfaceClass(UserService.class).ref(new UserServiceImpl()).protocolIds("rest"))
.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ protected static String getThreadPoolPrefixName(URL url) {
}

protected static int getThreadPoolSize(URL url) {
return url.getParameter(THREAD_POOL_SIZE_PARAM_NAME, DEFAULT_THREAD_POOL_SIZE);
return getParameter(url, THREAD_POOL_SIZE_PARAM_NAME, DEFAULT_THREAD_POOL_SIZE);
}

protected static long getThreadPoolKeepAliveTime(URL url) {
return url.getParameter(THREAD_POOL_KEEP_ALIVE_TIME_PARAM_NAME, DEFAULT_THREAD_POOL_KEEP_ALIVE_TIME);
return getParameter(url, THREAD_POOL_KEEP_ALIVE_TIME_PARAM_NAME, DEFAULT_THREAD_POOL_KEEP_ALIVE_TIME);
}

protected static String getParameter(URL url, String name, String defaultValue) {
Expand All @@ -202,4 +202,18 @@ protected static String getParameter(URL url, String name, String defaultValue)
}
return defaultValue;
}

protected static int getParameter(URL url, String name, int defaultValue) {
if (url != null) {
return url.getParameter(name, defaultValue);
}
return defaultValue;
}

protected static long getParameter(URL url, String name, long defaultValue) {
if (url != null) {
return url.getParameter(name, defaultValue);
}
return defaultValue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY;

/**
* Abstract {@link DynamicConfigurationFactory} implementation with cache ability
*
* @see DynamicConfigurationFactory
* @since 2.7.4
*/
public abstract class AbstractDynamicConfigurationFactory implements DynamicConfigurationFactory {

private volatile Map<String, DynamicConfiguration> dynamicConfigurations = new ConcurrentHashMap<>();

@Override
public DynamicConfiguration getDynamicConfiguration(URL url) {
public final DynamicConfiguration getDynamicConfiguration(URL url) {
String key = url == null ? DEFAULT_KEY : url.getAddress();
return dynamicConfigurations.computeIfAbsent(key, k -> createDynamicConfiguration(url));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public ConfigChangedEvent(String key, String group, String content) {
}

public ConfigChangedEvent(String key, String group, String content, ConfigChangeType changeType) {
super(key + "=" + content);
super(key + "," + group);
this.key = key;
this.group = group;
this.content = content;
Expand All @@ -62,29 +62,29 @@ public ConfigChangeType getChangeType() {
return changeType;
}

@Override
public String toString() {
return "ConfigChangedEvent{" +
"key='" + key + '\'' +
", group='" + group + '\'' +
", content='" + content + '\'' +
", changeType=" + changeType +
"} " + super.toString();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ConfigChangedEvent)) return false;
ConfigChangedEvent that = (ConfigChangedEvent) o;
return Objects.equals(getKey(), that.getKey()) &&
Objects.equals(group, that.group) &&
Objects.equals(getGroup(), that.getGroup()) &&
Objects.equals(getContent(), that.getContent()) &&
getChangeType() == that.getChangeType();
}

@Override
public int hashCode() {
return Objects.hash(getKey(), group, getContent(), getChangeType());
}

@Override
public String toString() {
return "ConfigChangedEvent{" +
"key='" + key + '\'' +
", group='" + group + '\'' +
", content='" + content + '\'' +
", changeType=" + changeType +
"} " + super.toString();
return Objects.hash(getKey(), getGroup(), getContent(), getChangeType());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -582,13 +582,13 @@ private static Optional<WatchService> newWatchService() {
}

protected static File initDirectory(URL url) {
String directoryPath = url.getParameter(CONFIG_CENTER_DIR_PARAM_NAME, url.getPath());
String directoryPath = getParameter(url, CONFIG_CENTER_DIR_PARAM_NAME, url == null ? null : url.getPath());
File rootDirectory = null;
if (!StringUtils.isBlank(directoryPath)) {
rootDirectory = new File("/" + directoryPath);
}

if (!rootDirectory.exists()) { // If the directory does not exist
if (directoryPath == null || !rootDirectory.exists()) { // If the directory does not exist
rootDirectory = new File(DEFAULT_CONFIG_CENTER_DIR_PATH);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ShutdownHookCallbacks {

private final List<ShutdownHookCallback> callbacks = new LinkedList<>();

public ShutdownHookCallbacks() {
ShutdownHookCallbacks() {
loadCallbacks();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.function.Predicate;
import java.util.stream.Collectors;

import static java.util.Collections.emptyMap;
import static org.apache.dubbo.common.constants.CommonConstants.ANY_VALUE;
import static org.apache.dubbo.common.constants.CommonConstants.CLASSIFIER_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
Expand All @@ -50,9 +51,11 @@
import static org.apache.dubbo.common.constants.RegistryConstants.OVERRIDE_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.PROVIDERS_CATEGORY;
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.ROUTERS_CATEGORY;
import static org.apache.dubbo.common.constants.RegistryConstants.ROUTE_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.SERVICE_REGISTRY_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.SERVICE_REGISTRY_TYPE;

public class UrlUtils {

Expand Down Expand Up @@ -490,6 +493,31 @@ public static boolean isRegistry(URL url) {
return REGISTRY_PROTOCOL.equals(url.getProtocol()) || SERVICE_REGISTRY_PROTOCOL.equalsIgnoreCase(url.getProtocol());
}

/**
* The specified {@link URL} is service discovery registry type or not
*
* @param url the {@link URL} connects to the registry
* @return If it is, return <code>true</code>, or <code>false</code>
* @since 2.7.4
*/
public static boolean isServiceDiscoveryRegistryType(URL url) {
return isServiceDiscoveryRegistryType(url == null ? emptyMap() : url.getParameters());
}

/**
* The specified parameters of {@link URL} is service discovery registry type or not
*
* @param parameters the parameters of {@link URL} that connects to the registry
* @return If it is, return <code>true</code>, or <code>false</code>
* @since 2.7.4
*/
public static boolean isServiceDiscoveryRegistryType(Map<String, String> parameters) {
if (parameters == null || parameters.isEmpty()) {
return false;
}
return SERVICE_REGISTRY_TYPE.equals(parameters.get(REGISTRY_TYPE_KEY));
}

/**
* Check if the given value matches the given pattern. The pattern supports wildcard "*".
*
Expand All @@ -507,7 +535,7 @@ static boolean isItemMatch(String pattern, String value) {

/**
* @param serviceKey, {group}/{interfaceName}:{version}
* @return [group, interfaceName, version]
* @return [group, interfaceName, version]
*/
public static String[] parseServiceKey(String serviceKey) {
String[] arr = new String[3];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
class InmemoryConfigurationTest {

private static InmemoryConfiguration memConfig;
private InmemoryConfiguration memConfig;
private static final String MOCK_KEY = "mockKey";
private static final String MOCK_VALUE = "mockValue";
private static final String MOCK_ONE_KEY = "one";
Expand Down Expand Up @@ -59,7 +59,6 @@ public void testGetMemProperty() {
Assertions.assertEquals(MOCK_VALUE, memConfig.getInternalProperty(MOCK_KEY));
Assertions.assertEquals(MOCK_VALUE, memConfig.getString(MOCK_KEY, MOCK_VALUE));
Assertions.assertEquals(MOCK_VALUE, memConfig.getProperty(MOCK_KEY, MOCK_VALUE));

}

/**
Expand All @@ -84,11 +83,27 @@ public void testGetProperties() {

}

@Test
public void testGetInt() {
memConfig.addProperty("a", "1");
Assertions.assertEquals(1, memConfig.getInt("a"));
Assertions.assertEquals(Integer.valueOf(1), memConfig.getInteger("a", 2));
Assertions.assertEquals(2, memConfig.getInt("b", 2));
}

@Test
public void getBoolean() {
memConfig.addProperty("a", Boolean.TRUE.toString());
Assertions.assertTrue(memConfig.getBoolean("a"));
Assertions.assertFalse(memConfig.getBoolean("b", false));
Assertions.assertTrue(memConfig.getBoolean("b", Boolean.TRUE));
}

/**
* Clean.
*/
@AfterEach
public void clean(){
public void clean() {

}

Expand Down
Loading