Sentinel
Sentinel copied to clipboard
为什么用非线程安全的HashMap,而不是ConcurrentHashMap?
看源码发现很少直接使用ConcurrentHashMap而是通过 上锁+copyAndWrite 的通过HashMap,来保障线程安全
此处为何不直接使用ConcurrentHashMap?

The chainMap here will only change at the very beginning of the application's start, then it will be stable. So we use Copy on Write Map to get higher concurrency performance.
但这个地方,每次chain==null时,不都得加锁判断么?
The
chainMaphere will only change at the very beginning of the application's start, then it will be stable. So we use Copy on Write Map to get higher concurrency performance.
是否多此一举?cmap早就不用分段锁了,所以cmap在读上的并发性能和hashmap是一个量级的吧?