This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new f1ec4a6  [3.0] Fix cached configuration not work (#9581)
f1ec4a6 is described below

commit f1ec4a66b24c1577fc5f6ed34090783dcb2e4e68
Author: Albumen Kevin <[email protected]>
AuthorDate: Sun Jan 16 15:41:19 2022 +0800

    [3.0] Fix cached configuration not work (#9581)
---
 .../java/org/apache/dubbo/common/bytecode/DubboLoaderClassPath.java | 2 +-
 .../java/org/apache/dubbo/common/config/ConfigurationCache.java     | 5 +++--
 .../java/org/apache/dubbo/common/config/InmemoryConfiguration.java  | 6 ++----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/DubboLoaderClassPath.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/DubboLoaderClassPath.java
index 1e47997..f0c5b37 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/DubboLoaderClassPath.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/DubboLoaderClassPath.java
@@ -32,7 +32,7 @@ public class DubboLoaderClassPath extends LoaderClassPath {
 
     @Override
     public InputStream openClassfile(String classname) throws 
NotFoundException {
-        if (!classname.startsWith("org.apache.dubbo")) {
+        if (!classname.startsWith("org.apache.dubbo") && 
!classname.startsWith("grpc.health") && !classname.startsWith("com.google")) {
             return null;
         }
         return super.openClassfile(classname);
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/ConfigurationCache.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/ConfigurationCache.java
index c4e5ab3..a00a3bf 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/ConfigurationCache.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/ConfigurationCache.java
@@ -16,7 +16,6 @@
  */
 package org.apache.dubbo.common.config;
 
-import org.apache.dubbo.common.utils.StringUtils;
 import org.apache.dubbo.rpc.model.ScopeModel;
 
 import java.util.Map;
@@ -38,7 +37,9 @@ public class ConfigurationCache {
      */
     public String computeIfAbsent(String key, Function<String, String> 
function) {
         String value = cache.get(key);
-        if (StringUtils.isEmpty(value)) {
+        // value might be empty here!
+        // empty value from config center will be cached here
+        if (value == null) {
             // lock free, tolerate repeat apply, will return previous value
             cache.putIfAbsent(key, function.apply(key));
             value = cache.get(key);
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/InmemoryConfiguration.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/InmemoryConfiguration.java
index 7b3fa98..92d808d 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/InmemoryConfiguration.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/InmemoryConfiguration.java
@@ -16,8 +16,6 @@
  */
 package org.apache.dubbo.common.config;
 
-import org.apache.dubbo.common.utils.CollectionUtils;
-
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -58,7 +56,7 @@ public class InmemoryConfiguration implements Configuration {
      * Add a set of properties into the store
      */
     public void addProperties(Map<String, String> properties) {
-        if (CollectionUtils.isNotEmptyMap(properties)) {
+        if (properties != null) {
             this.store.putAll(properties);
         }
     }
@@ -67,7 +65,7 @@ public class InmemoryConfiguration implements Configuration {
      * set store
      */
     public void setProperties(Map<String, String> properties) {
-        if (CollectionUtils.isNotEmptyMap(properties)) {
+        if (properties != null) {
             this.store = properties;
         }
     }

Reply via email to