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

jimin pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 424c826208 optimize: upgrade the byte-buddy version to 1.14.15 (#6548)
424c826208 is described below

commit 424c82620829e807e823495ec05c2fc781515403
Author: funkye <[email protected]>
AuthorDate: Wed May 15 20:16:52 2024 +0800

    optimize: upgrade the byte-buddy version to 1.14.15 (#6548)
---
 .github/workflows/test.yml                         | 13 +++-
 changes/en-us/2.x.md                               |  1 +
 changes/zh-cn/2.x.md                               |  1 +
 .../apache/seata/config/ConfigurationFactory.java  | 10 ++--
 .../io/seata/config/nacos/NacosConfiguration.java  | 69 +++++++++++-----------
 .../io/seata/config/nacos/TestConfigCustomSPI.java | 20 ++++---
 .../src/test/resources/registry-test.conf          |  1 +
 dependencies/pom.xml                               |  2 +-
 8 files changed, 69 insertions(+), 48 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index feda1f9307..fcb508bcb6 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -40,8 +40,17 @@ jobs:
           java-version: ${{ matrix.java }}
       # step 3
       ## step 3.1: for Ubuntu and MacOS
-      - name: "Test with Maven on '${{ matrix.os }}' OS"
-        if: matrix.os != 'windows'
+      - name: "Test with Maven on MacOS"
+        if: matrix.os == 'macos'
+        run: |
+          ./mvnw     -version;
+          ./mvnw     -T 4C clean test \
+                     -P args-for-client-test \
+                     -Dspring-boot.version=${{ matrix.springboot }} \
+                     -Dmaven.git-commit-id.skip=true \
+                     -e -B 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
+      - name: "Test with Maven on ‘ubuntu' OS"
+        if: matrix.os == 'ubuntu'
         run: |
           ./mvnw     -version;
           ./mvnw     -T 4C clean test \
diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 204a64c9bc..0feddeb6b8 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -131,6 +131,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#6458](https://github.com/apache/incubator-seata/pull/6458)] add null 
value check for MAC address
 - [[#6516](https://github.com/apache/incubator-seata/pull/6516)] optimize code 
format
 - [[#6529](https://github.com/apache/incubator-seata/pull/6529)] optimize 
release maven plugin
+- [[#6548](https://github.com/apache/incubator-seata/pull/6548)] upgrade the 
byte-buddy version to 1.14.15
 - [[#6539](https://github.com/apache/incubator-seata/pull/6539)] add 
subcomponents license
 - [[#6540](https://github.com/apache/incubator-seata/pull/6540)] exclude 
com.google.guava:listenablefuture
 
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 722b4e89ea..824a909086 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -130,6 +130,7 @@
 - [[#6412](https://github.com/apache/incubator-seata/pull/6412)] 优化 core 兼容模块
 - [[#6518](https://github.com/apache/incubator-seata/pull/6518)] 优化 
ConfigurationCache 代理方法
 - [[#6529](https://github.com/apache/incubator-seata/pull/6529)] 优化发布插件
+- [[#6548](https://github.com/apache/incubator-seata/pull/6548)] 
升级byte-buddy版本至1.14.15
 - [[#6539](https://github.com/apache/incubator-seata/pull/6539)] 增加组件 license
 - [[#6540](https://github.com/apache/incubator-seata/pull/6540)] 排除  
com.google.guava:listenablefuture 依赖
 
diff --git 
a/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationFactory.java
 
b/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationFactory.java
index 22d94903f6..a05235afbc 100644
--- 
a/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationFactory.java
+++ 
b/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationFactory.java
@@ -173,8 +173,6 @@ public final class ConfigurationFactory {
             if (null != configurationCache) {
                 extConfiguration = configurationCache;
             }
-        } catch (EnhancedServiceNotFoundException ignore) {
-
         } catch (Exception e) {
             LOGGER.error("failed to load configurationCacheProvider:{}", 
e.getMessage(), e);
         }
@@ -225,7 +223,7 @@ public final class ConfigurationFactory {
         return null;
     }
 
-    protected static void reload() {
+    public static void reload() {
         ConfigurationCache.clear();
         initOriginConfiguraction();
         load();
@@ -298,13 +296,15 @@ public final class ConfigurationFactory {
             ConfigurationChangeEvent newEvent = new ConfigurationChangeEvent();
             
newEvent.setDataId(event.getDataId()).setOldValue(event.getOldValue()).setNewValue(event.getNewValue())
                 .setNamespace(event.getNamespace());
-            
newEvent.setChangeType(ConfigurationChangeType.values()[event.getChangeType().ordinal()]);
+            if (event.getChangeType() != null) {
+                
newEvent.setChangeType(ConfigurationChangeType.values()[event.getChangeType().ordinal()]);
+            }
             return newEvent;
         }
 
         @Override
         public void onChangeEvent(io.seata.config.ConfigurationChangeEvent 
event) {
-            listener.onChangeEvent(convert(event));
+            onProcessEvent(event);
         }
 
         @Override
diff --git 
a/config/seata-config-nacos/src/test/java/io/seata/config/nacos/NacosConfiguration.java
 
b/config/seata-config-nacos/src/test/java/io/seata/config/nacos/NacosConfiguration.java
index e3c3116bd3..87e3c39dbf 100644
--- 
a/config/seata-config-nacos/src/test/java/io/seata/config/nacos/NacosConfiguration.java
+++ 
b/config/seata-config-nacos/src/test/java/io/seata/config/nacos/NacosConfiguration.java
@@ -23,6 +23,8 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
 
 import com.alibaba.nacos.api.NacosFactory;
 import com.alibaba.nacos.api.config.ConfigService;
@@ -198,7 +200,7 @@ public class NacosConfiguration extends 
io.seata.config.AbstractConfiguration {
         }
     }
 
-    private static Properties getConfigProperties() {
+    protected static Properties getConfigProperties() {
         Properties properties = new Properties();
         
properties.setProperty(ConfigurationKeys.IS_USE_CLOUD_NAMESPACE_PARSING, 
USE_PARSE_RULE);
         properties.setProperty(ConfigurationKeys.IS_USE_ENDPOINT_PARSING_RULE, 
USE_PARSE_RULE);
@@ -278,7 +280,6 @@ public class NacosConfiguration extends 
io.seata.config.AbstractConfiguration {
      * Non-blocking subscriptions prohibit adding subscriptions in the thread 
pool to prevent thread termination
      */
     public static class NacosListener extends AbstractSharedListener {
-        private final String dataId;
         private final ConfigurationChangeListener listener;
 
         /**
@@ -288,7 +289,6 @@ public class NacosConfiguration extends 
io.seata.config.AbstractConfiguration {
          * @param listener the listener
          */
         public NacosListener(String dataId, ConfigurationChangeListener 
listener) {
-            this.dataId = dataId;
             this.listener = listener;
         }
 
@@ -303,42 +303,45 @@ public class NacosConfiguration extends 
io.seata.config.AbstractConfiguration {
 
         @Override
         public void innerReceive(String dataId, String group, String 
configInfo) {
-            //The new configuration method to puts all configurations into a 
dateId
-            if (getNacosDataId().equals(dataId)) {
-                Properties seataConfigNew = new Properties();
-                if (StringUtils.isNotBlank(configInfo)) {
-                    try {
-                        seataConfigNew = 
ConfigProcessor.processConfig(configInfo, getNacosDataType());
-                    } catch (IOException e) {
-                        LOGGER.error("load config properties error", e);
-                        return;
+            try {
+                //The new configuration method to puts all configurations into 
a dateId
+                if (getNacosDataId().equals(dataId)) {
+                    Properties seataConfigNew = new Properties();
+                    if (StringUtils.isNotBlank(configInfo)) {
+                        try {
+                            seataConfigNew = 
ConfigProcessor.processConfig(configInfo, getNacosDataType());
+                        } catch (IOException e) {
+                            LOGGER.error("load config properties error", e);
+                            return;
+                        }
                     }
-                }
-
-                //Get all the monitored dataids and judge whether it has been 
modified
-                for (Map.Entry<String, 
ConcurrentMap<ConfigurationChangeListener, NacosListener>> entry :
-                    CONFIG_LISTENERS_MAP.entrySet()) {
-                    String listenedDataId = entry.getKey();
-                    String propertyOld = 
seataConfig.getProperty(listenedDataId, "");
-                    String propertyNew = 
seataConfigNew.getProperty(listenedDataId, "");
-                    if (!propertyOld.equals(propertyNew)) {
-                        ConfigurationChangeEvent event = new 
ConfigurationChangeEvent().setDataId(listenedDataId)
-                            .setNewValue(propertyNew).setNamespace(group);
-
-                        ConcurrentMap<ConfigurationChangeListener, 
NacosListener> configListeners = entry.getValue();
-                        for (ConfigurationChangeListener configListener : 
configListeners.keySet()) {
-                            configListener.onProcessEvent(event);
+                    //Get all the monitored dataids and judge whether it has 
been modified
+                    for (Map.Entry<String, 
ConcurrentMap<ConfigurationChangeListener, NacosListener>> entry : 
CONFIG_LISTENERS_MAP.entrySet()) {
+                        String listenedDataId = entry.getKey();
+                        String propertyOld = 
seataConfig.getProperty(listenedDataId, "");
+                        String propertyNew = 
seataConfigNew.getProperty(listenedDataId, "");
+                        if (!propertyOld.equals(propertyNew)) {
+                            ConfigurationChangeEvent event =
+                                new 
ConfigurationChangeEvent().setDataId(listenedDataId).setNewValue(propertyNew)
+                                    .setNamespace(group);
+
+                            ConcurrentMap<ConfigurationChangeListener, 
NacosListener> configListeners =
+                                entry.getValue();
+                            for (ConfigurationChangeListener configListener : 
configListeners.keySet()) {
+                                configListener.onProcessEvent(event);
+                            }
                         }
                     }
-                }
 
-                seataConfig = seataConfigNew;
-                return;
+                    seataConfig = seataConfigNew;
+                    return;
+                }
+            } catch (Exception e) {
+                LOGGER.error("innerReceive error: {}", e.getMessage(), e);
             }
-
             //Compatible with old writing
-            ConfigurationChangeEvent event = new 
ConfigurationChangeEvent().setDataId(dataId).setNewValue(configInfo)
-                .setNamespace(group);
+            ConfigurationChangeEvent event =
+                new 
ConfigurationChangeEvent().setDataId(dataId).setNewValue(configInfo).setNamespace(group);
             listener.onProcessEvent(event);
         }
     }
diff --git 
a/config/seata-config-nacos/src/test/java/io/seata/config/nacos/TestConfigCustomSPI.java
 
b/config/seata-config-nacos/src/test/java/io/seata/config/nacos/TestConfigCustomSPI.java
index 93315924ad..54e1bbd846 100644
--- 
a/config/seata-config-nacos/src/test/java/io/seata/config/nacos/TestConfigCustomSPI.java
+++ 
b/config/seata-config-nacos/src/test/java/io/seata/config/nacos/TestConfigCustomSPI.java
@@ -20,16 +20,20 @@ import java.security.SecureRandom;
 import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import com.alibaba.nacos.api.NacosFactory;
 import com.alibaba.nacos.api.config.ConfigService;
+import com.alibaba.nacos.api.config.listener.AbstractSharedListener;
 import com.alibaba.nacos.api.exception.NacosException;
 
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import org.apache.seata.config.CachedConfigurationChangeListener;
 import org.apache.seata.config.Configuration;
+import org.apache.seata.config.ConfigurationCache;
 import org.apache.seata.config.ConfigurationChangeEvent;
 import org.apache.seata.config.ConfigurationChangeListener;
 import org.apache.seata.config.ConfigurationFactory;
@@ -40,7 +44,7 @@ import org.junit.jupiter.api.Test;
 
 public class TestConfigCustomSPI {
 
-    private static final Config FILE_CONFIG = 
ConfigFactory.load("registry-test.conf");
+    private static  Config FILE_CONFIG;
     private static ConfigService configService;
 
     private static final String CHARACTERS = "abcdefghijklmnopqrstuvwxyz";
@@ -51,11 +55,11 @@ public class TestConfigCustomSPI {
 
     @BeforeAll
     public static void setup() throws NacosException {
-        String serverAddr = FILE_CONFIG.getString("config.test.serverAddr");
-        Properties properties = new Properties();
-        properties.put("serverAddr", serverAddr);
-        configService = NacosFactory.createConfigService(properties);
         System.setProperty("seataEnv", "test");
+        ConfigurationFactory.reload();
+        ConfigurationCache.clear();
+        FILE_CONFIG = ConfigFactory.load("registry-test.conf");
+        configService = 
NacosFactory.createConfigService(NacosConfiguration.getConfigProperties());
     }
 
     @Test
@@ -76,13 +80,13 @@ public class TestConfigCustomSPI {
         });
         configService.publishConfig(dataId, group, content);
         boolean reachZero = listenerCountDown.await(5, TimeUnit.SECONDS);
-        Assertions.assertFalse(reachZero);
+        Assertions.assertTrue(reachZero);
         //get config
         String config = configuration.getConfig(dataId);
         Assertions.assertEquals(content, config);
         //listener
         Set<ConfigurationChangeListener> listeners = 
configuration.getConfigListeners(dataId);
-        Assertions.assertEquals(2, listeners.size());
+        Assertions.assertEquals(1, listeners.size());
 
     }
 
@@ -96,5 +100,7 @@ public class TestConfigCustomSPI {
 
     @AfterAll
     public static void afterAll() {
+        ConfigurationFactory.reload();
+        ConfigurationCache.clear();
     }
 }
diff --git a/config/seata-config-nacos/src/test/resources/registry-test.conf 
b/config/seata-config-nacos/src/test/resources/registry-test.conf
index 2b094f0433..0def5192c6 100644
--- a/config/seata-config-nacos/src/test/resources/registry-test.conf
+++ b/config/seata-config-nacos/src/test/resources/registry-test.conf
@@ -92,6 +92,7 @@ config {
       serverAddr = "console.nacos.io:80"
       namespace = ""
       group = "SEATA_GROUP"
+      dataId = ""
   }
   consul {
     serverAddr = "127.0.0.1:8500"
diff --git a/dependencies/pom.xml b/dependencies/pom.xml
index 54dc3d8abb..48b73bccbc 100644
--- a/dependencies/pom.xml
+++ b/dependencies/pom.xml
@@ -39,7 +39,7 @@
         <dubbo-seata.version>1.0.2</dubbo-seata.version>
         <brpc.version>2.5.9</brpc.version>
         <hsf.version>1.8.3</hsf.version>
-        <bytebuddy.version>1.12.17</bytebuddy.version>
+        <bytebuddy.version>1.14.15</bytebuddy.version>
         <dubbo.alibaba.version>2.6.10</dubbo.alibaba.version>
         <sofa.rpc.version>5.6.5</sofa.rpc.version>
         <fastjson.version>1.2.83</fastjson.version>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to