You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by hy...@apache.org on 2020/09/04 07:28:44 UTC
[dubbo] branch master updated: simplify code for Wrapper.java and
others (#6684)
This is an automated email from the ASF dual-hosted git repository.
hyunkun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new ae514c0 simplify code for Wrapper.java and others (#6684)
ae514c0 is described below
commit ae514c0f8a726268b9a42fe1903e1f59d6d24c3f
Author: 石头 <10...@qq.com>
AuthorDate: Fri Sep 4 15:28:05 2020 +0800
simplify code for Wrapper.java and others (#6684)
---
.../src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java | 2 +-
.../src/main/java/org/apache/dubbo/config/context/ConfigManager.java | 4 +---
.../java/org/apache/dubbo/registry/multicast/MulticastRegistry.java | 4 +---
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java
index 509ae98..345b79e 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java
@@ -113,7 +113,7 @@ public abstract class Wrapper {
return OBJECT_WRAPPER;
}
- return WRAPPER_MAP.computeIfAbsent(c, key -> makeWrapper(key));
+ return WRAPPER_MAP.computeIfAbsent(c, Wrapper::makeWrapper);
}
private static Wrapper makeWrapper(Class<?> c) {
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java b/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
index 218fef0..e6c5fef 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
@@ -374,9 +374,7 @@ public class ConfigManager extends LifecycleAdapter implements FrameworkExt {
}
public void clear() {
- write(() -> {
- this.configsCache.clear();
- });
+ write(this.configsCache::clear);
}
/**
diff --git a/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java
index 3a6462d..7807fec 100644
--- a/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java
+++ b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java
@@ -361,9 +361,7 @@ public class MulticastRegistry extends FailbackRegistry {
private List<URL> toList(Set<URL> urls) {
List<URL> list = new ArrayList<URL>();
if (CollectionUtils.isNotEmpty(urls)) {
- for (URL url : urls) {
- list.add(url);
- }
+ list.addAll(urls);
}
return list;
}