From 43cd56ac2c1fe6b6941c73b9396dcdd13667a221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=B4=E8=8A=82?= Date: Mon, 4 Mar 2024 17:39:38 +0800 Subject: [PATCH 1/2] add spring-boot-configuration-processor in sofa-boot-actuator-autoconfigure model --- sofa-boot-project/sofa-boot-actuator-autoconfigure/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sofa-boot-project/sofa-boot-actuator-autoconfigure/pom.xml b/sofa-boot-project/sofa-boot-actuator-autoconfigure/pom.xml index f3ecd8c69..16b1ee9ad 100644 --- a/sofa-boot-project/sofa-boot-actuator-autoconfigure/pom.xml +++ b/sofa-boot-project/sofa-boot-actuator-autoconfigure/pom.xml @@ -30,6 +30,12 @@ spring-boot-actuator-autoconfigure + + org.springframework.boot + spring-boot-configuration-processor + true + + com.alipay.sofa runtime-sofa-boot From 9356703cbc28365ed165dce3e81e1577f208afc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=B4=E8=8A=82?= Date: Wed, 6 Mar 2024 15:00:30 +0800 Subject: [PATCH 2/2] fix JvmFilterHolder concurrent safe problem --- .../alipay/sofa/runtime/filter/JvmFilterHolder.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/filter/JvmFilterHolder.java b/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/filter/JvmFilterHolder.java index 03ffd8d5d..0fd5c9971 100644 --- a/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/filter/JvmFilterHolder.java +++ b/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/filter/JvmFilterHolder.java @@ -18,9 +18,8 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicBoolean; /** @@ -31,7 +30,7 @@ */ public class JvmFilterHolder { - private final List JVM_FILTERS = new ArrayList<>(); + private final List JVM_FILTERS = new CopyOnWriteArrayList<>(); private final AtomicBoolean FILTERS_SORTED = new AtomicBoolean(false); @@ -56,8 +55,8 @@ public List getJvmFilters() { } public static boolean beforeInvoking(JvmFilterContext context) { - List filters = Collections.unmodifiableList(context.getSofaRuntimeContext() - .getJvmFilterHolder().getJvmFilters()); + List filters = context.getSofaRuntimeContext().getJvmFilterHolder() + .getJvmFilters(); for (JvmFilter filter : filters) { if (!filter.before(context)) { return false; @@ -67,8 +66,8 @@ public static boolean beforeInvoking(JvmFilterContext context) { } public static boolean afterInvoking(JvmFilterContext context) { - List filters = Collections.unmodifiableList(context.getSofaRuntimeContext() - .getJvmFilterHolder().getJvmFilters()); + List filters = context.getSofaRuntimeContext().getJvmFilterHolder() + .getJvmFilters(); for (int i = filters.size() - 1; i >= 0; --i) { if (!filters.get(i).after(context)) { return false;