HDFS-15249 ThrottledAsyncChecker is not thread-safe. (#1922)
(cherry picked from commit c12ddbd1de
)
This commit is contained in:
parent
6d3f5e844b
commit
e9b06d942c
|
@ -117,8 +117,8 @@ public class ThrottledAsyncChecker<K, V> implements AsyncChecker<K, V> {
|
||||||
* will receive the same Future.
|
* will receive the same Future.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<ListenableFuture<V>> schedule(Checkable<K, V> target,
|
public synchronized Optional<ListenableFuture<V>> schedule(
|
||||||
K context) {
|
Checkable<K, V> target, K context) {
|
||||||
if (checksInProgress.containsKey(target)) {
|
if (checksInProgress.containsKey(target)) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue