This is an automated email from the ASF dual-hosted git repository.
liuhongyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 6632d5e170 [fix] fix data sync bug (#6165)
6632d5e170 is described below
commit 6632d5e170d1dbb9c3a291fbb23c7a4c71e49da8
Author: ywwana <[email protected]>
AuthorDate: Wed Sep 17 13:32:33 2025 +0800
[fix] fix data sync bug (#6165)
* [fix] Modify the test data of the sample test MotanPluginTest
* [fix] Resolve CommonPluginDataSubscriber class conflict
---------
Co-authored-by: ywwana <[email protected]>
---
.../plugin/base/cache/CommonPluginDataSubscriber.java | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonPluginDataSubscriber.java
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonPluginDataSubscriber.java
index 467fff3458..b2fc41b380 100644
---
a/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonPluginDataSubscriber.java
+++
b/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonPluginDataSubscriber.java
@@ -27,6 +27,7 @@ import org.apache.shenyu.common.enums.DataEventTypeEnum;
import org.apache.shenyu.common.enums.PluginHandlerEventEnum;
import org.apache.shenyu.common.enums.TrieCacheTypeEnum;
import org.apache.shenyu.common.enums.TrieEventEnum;
+import org.apache.shenyu.common.utils.JsonUtils;
import org.apache.shenyu.common.utils.MapUtils;
import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
import org.apache.shenyu.plugin.base.event.TrieEvent;
@@ -195,12 +196,16 @@ public class CommonPluginDataSubscriber implements
PluginDataSubscriber {
}
private <T> void subscribeDataHandler(final T classData, final
DataEventTypeEnum dataType) {
- if (dataType == DataEventTypeEnum.UPDATE) {
- Optional.ofNullable(classData)
- .ifPresent(data -> updateCacheData(classData));
- } else if (dataType == DataEventTypeEnum.DELETE) {
- Optional.ofNullable(classData)
- .ifPresent(data -> removeCacheData(classData));
+ try {
+ if (dataType == DataEventTypeEnum.UPDATE) {
+ Optional.ofNullable(classData)
+ .ifPresent(data -> updateCacheData(classData));
+ } else if (dataType == DataEventTypeEnum.DELETE) {
+ Optional.ofNullable(classData)
+ .ifPresent(data -> removeCacheData(classData));
+ }
+ } catch (Exception e) {
+ LOG.error("subscribe data handler error, classData: {}, dataType:
{}", JsonUtils.toJson(classData), dataType, e);
}
}