From aeaad006cd926f7c6742c270da1ce96f4d3228df Mon Sep 17 00:00:00 2001 From: dugenkui03 Date: Sat, 16 Apr 2022 21:21:18 +0800 Subject: [PATCH 1/2] Make event handling in ClassPathFileSystemWatcherTests thread-safe See gh-30844 --- .../devtools/classpath/ClassPathFileSystemWatcherTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java index 1bd8ba26fa..146f542e96 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -116,7 +117,7 @@ class ClassPathFileSystemWatcherTests { static class Listener implements ApplicationListener { - private List events = new ArrayList<>(); + private List events = new CopyOnWriteArrayList<>(); @Override public void onApplicationEvent(ClassPathChangedEvent event) { From 798d61fcf09e7765464c338d96470850d99ba24a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 3 May 2022 13:54:13 +0100 Subject: [PATCH 2/2] Polish "Make event handling in ClassPathFileSystemWatcherTests thread-safe" See gh-30844 --- .../devtools/classpath/ClassPathFileSystemWatcherTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java index 146f542e96..f98c92a44c 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/classpath/ClassPathFileSystemWatcherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.