From f6e96a24d449630ded4ed41346935480da4952a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Basl=C3=A9?= Date: Tue, 17 Sep 2024 16:33:29 +0200 Subject: [PATCH] Add BlockHound exception for ConcurrentReferenceHashMap$ReferenceManager This commit adds a SpringCoreBlockHoundIntegration configuration to allows `pollForPurge` method to block. Closes gh-33450 --- .../springframework/core/ReactiveAdapterRegistry.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java b/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java index 994b6e036e1..afc77e0225d 100644 --- a/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java +++ b/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java @@ -442,10 +442,13 @@ public class ReactiveAdapterRegistry { public void applyTo(BlockHound.Builder builder) { // Avoid hard references potentially anywhere in spring-core (no need for structural dependency) - String className = "org.springframework.util.ConcurrentReferenceHashMap$Segment"; - builder.allowBlockingCallsInside(className, "doTask"); - builder.allowBlockingCallsInside(className, "clear"); - builder.allowBlockingCallsInside(className, "restructure"); + String segmentClassName = "org.springframework.util.ConcurrentReferenceHashMap$Segment"; + builder.allowBlockingCallsInside(segmentClassName, "doTask"); + builder.allowBlockingCallsInside(segmentClassName, "clear"); + builder.allowBlockingCallsInside(segmentClassName, "restructure"); + + String referenceManagerClassName = "org.springframework.util.ConcurrentReferenceHashMap$ReferenceManager"; + builder.allowBlockingCallsInside(referenceManagerClassName, "pollForPurge"); } }