HDFS-15249 ThrottledAsyncChecker is not thread-safe. (#1922)

This commit is contained in:
Toshihiro Suzuki 2020-04-07 14:38:09 +09:00 committed by GitHub
parent 0b855b9f35
commit c12ddbd1de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -117,8 +117,8 @@ public class ThrottledAsyncChecker<K, V> implements AsyncChecker<K, V> {
* will receive the same Future.
*/
@Override
public Optional<ListenableFuture<V>> schedule(Checkable<K, V> target,
K context) {
public synchronized Optional<ListenableFuture<V>> schedule(
Checkable<K, V> target, K context) {
if (checksInProgress.containsKey(target)) {
return Optional.empty();
}