关于ConcurrentHashMap迭代器遍历的问题
Author: Decade-qiuCreated Feb 23, 2026Updated Apr 16, 2026
这里将ConcurrentHashMap归类于fail-safe是不对的,因为ConcurrentHashMap遍历时是弱一致性(Weakly Consistent),并不会在遍历时clone原始数据。
所以多线程场景下会有数据不一致问题,并且不会抛出异常。
Source: itwanger/toBeBetterJavaer