From 08463d387c5267b64dece1171c73c8f3c3194b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=B4=E8=8A=82?= Date: Tue, 16 Apr 2024 11:31:52 +0800 Subject: [PATCH] avoid concurrent problem in JvmFilterHolder --- .../java/com/alipay/sofa/runtime/filter/JvmFilterHolder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 e8aacb454..cfa173e0e 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,9 @@ import org.springframework.core.Ordered; -import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicBoolean; /** @@ -28,7 +28,7 @@ * Created on 2020/8/18 */ public class JvmFilterHolder { - private static final List JVM_FILTERS = new ArrayList<>(); + private static final List JVM_FILTERS = new CopyOnWriteArrayList<>(); private static final AtomicBoolean filtersSorted = new AtomicBoolean(false); private static final Comparator comparator = (f1, f2) -> {