DomGarguilo commented on code in PR #6052:
URL: https://github.com/apache/accumulo/pull/6052#discussion_r2686915241


##########
core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java:
##########
@@ -74,9 +74,11 @@ public String get(Property property) {
 
   @Override
   public void getProperties(Map<String,String> props, Predicate<String> 
filter) {
-    for (Entry<String,String> entry : copy.entrySet()) {
-      if (filter.test(entry.getKey())) {
-        props.put(entry.getKey(), entry.getValue());
+    synchronized (copy) {

Review Comment:
   I was looking into this to learn more about it and I actually cannot find 
info that says forEach is automatically synchronized. Did you see that 
somewhere?
   
   I was going based off the javadoc which says
   
   > It is imperative that the user manually synchronize on the returned map 
when traversing any of its collection views via Iterator, Spliterator or Stream:
   
   And I thought forEach just used an Iterator under the hood. 
   
   I did see that its possible that some implementations of the forEach method 
do the synchronization internally but its best to explicitly iterate in a sync 
block 



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

Reply via email to