From c12ddbd1de40b32bbe2f6a3e484abf843d6d92ae Mon Sep 17 00:00:00 2001 From: Toshihiro Suzuki Date: Tue, 7 Apr 2020 14:38:09 +0900 Subject: [PATCH] HDFS-15249 ThrottledAsyncChecker is not thread-safe. (#1922) --- .../hdfs/server/datanode/checker/ThrottledAsyncChecker.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/ThrottledAsyncChecker.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/ThrottledAsyncChecker.java index 032379a4d12..6f04129b492 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/ThrottledAsyncChecker.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/checker/ThrottledAsyncChecker.java @@ -117,8 +117,8 @@ public class ThrottledAsyncChecker implements AsyncChecker { * will receive the same Future. */ @Override - public Optional> schedule(Checkable target, - K context) { + public synchronized Optional> schedule( + Checkable target, K context) { if (checksInProgress.containsKey(target)) { return Optional.empty(); }