lokeshj1703 commented on a change in pull request #2895:
URL: https://github.com/apache/ozone/pull/2895#discussion_r764597608



##########
File path: 
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/ResourceLimitCache.java
##########
@@ -79,7 +79,11 @@ public V remove(K key) {
   @Override
   public void removeIf(Predicate<K> predicate) {
     Objects.requireNonNull(predicate);
-    map.keySet().removeIf(predicate);
+    for (K key : new ArrayList<>(map.keySet())) {

Review comment:
       I agree. Maybe we should replace the for loop with 
`ConcurrentMap.forEach(BiConsumer<? super K, ? super V> action)`. Since the 
method is exposed by the interface it should provide the thread safety 
guarantees.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to