Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1412 fix concurrency issue in CopyOnWriteMap
the default method `Map.getOrDefault` is not thread-safe: the condition `if (v == null && containsKey(key))` leaves `v = null` if the `key` was added by another thread exactly at the same moment. Then both conditions are true: `v==null` and `containsKey(key)`. Now `CopyOnWriteMap.getOrDefault` does NOT check `containsKey(key)`. As a consequence, `CopyOnWriteMap` doesn't allow putting `null` values to the map.
- Loading branch information