From 035a16278e7c74815b1cb72d1418df175308b0c0 Mon Sep 17 00:00:00 2001 From: dugenkui03 Date: Thu, 24 Mar 2022 01:09:30 +0800 Subject: [PATCH] Make ApplicationAvailabilityBean threadsafe See gh-30489 --- .../boot/availability/ApplicationAvailabilityBean.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/availability/ApplicationAvailabilityBean.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/availability/ApplicationAvailabilityBean.java index f65bf5dc72..2ed3183245 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/availability/ApplicationAvailabilityBean.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/availability/ApplicationAvailabilityBean.java @@ -16,8 +16,8 @@ package org.springframework.boot.availability; -import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -38,7 +38,7 @@ import org.springframework.util.Assert; public class ApplicationAvailabilityBean implements ApplicationAvailability, ApplicationListener> { - private final Map, AvailabilityChangeEvent> events = new HashMap<>(); + private final Map, AvailabilityChangeEvent> events = new ConcurrentHashMap<>(); private final Log logger;