`ConcurrentHashMap#putIfAbsent` doesn't acquire a lock anymore
see:
@@ -1216,10 +1216,7 @@ public final class BuildOptions implements Cloneable, Serializable {
@Override
public void prime(OptionsDiffForReconstruction optionsDiff) {
- // Avoid the lock-acquiring overhead of put() if it's already present.
- if (!map.containsKey(optionsDiff.getChecksum())) {
- map.put(optionsDiff.getChecksum(), optionsDiff);
- }
+ map.putIfAbsent(optionsDiff.getChecksum(), optionsDiff);
}
}
}
