ilgrosso commented on code in PR #571: URL: https://github.com/apache/syncope/pull/571#discussion_r1421355741
########## core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/LDAPMembershipPullActions.java: ########## @@ -155,8 +156,10 @@ public void beforeUpdate( groupDAO.findUMemberships(groupDAO.find(entity.getKey())).forEach(uMembership -> { Set<String> memb = membershipsBefore.get(uMembership.getLeftEnd().getKey()); if (memb == null) { - memb = new HashSet<>(); - membershipsBefore.put(uMembership.getLeftEnd().getKey(), memb); + memb = Collections.synchronizedSet(new HashSet<>()); Review Comment: This snippet should be replaced by using `ConcurrentHashMap#computeIfAbsent`, which involves declaring both maps as `ConcurrentMap` - see https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentMap.html#computeIfAbsent-K-java.util.function.Function- e.g. ```java Set<String> memb = membershipsBefore.computeIfAbsent( uMembership.getLeftEnd().getKey(), k -> Collections.synchronizedSet(new HashSet<>())); memb.add(entity.getKey()); ``` -- 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: dev-unsubscr...@syncope.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org