diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeHotSwapVolumes.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeHotSwapVolumes.java index e72c499624d..d98047f47fa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeHotSwapVolumes.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeHotSwapVolumes.java @@ -549,7 +549,8 @@ public class TestDataNodeHotSwapVolumes { dn.data = Mockito.spy(data); final int newVolumeCount = 40; - List addVolumeDelayedThreads = new ArrayList<>(); + List addVolumeDelayedThreads = + Collections.synchronizedList(new ArrayList<>()); AtomicBoolean addVolumeError = new AtomicBoolean(false); AtomicBoolean listStorageError = new AtomicBoolean(false); CountDownLatch addVolumeCompletionLatch =