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



##########
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 think we can use a combination of forEach and remove mehods exposed by 
ConcurrentMap interface. Since ConcurrentMap operations are thread safe, it 
should not throw concurrent modification errors.
   Ref: 
https://stackoverflow.com/questions/3768554/is-iterating-concurrenthashmap-values-thread-safe




-- 
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