File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 77## 数据结构
88![ ] ( https://ws2.sinaimg.cn/large/006tNc79ly1fn2f5pgxinj30dw0730t7.jpg )
99
10- 如图所示,是由 Segment 数组,以及 ` HashEntry ` 数组组成,和 HashMap 一样,仍然是数组加链表组成。
10+ 如图所示,是由 ` Segment ` 数组、 ` HashEntry ` 数组组成,和 ` HashMap ` 一样,仍然是数组加链表组成。
1111
12- ` ConcurrentHashMap ` 采用了分段锁技术,其中 ` Segment ` 继承于 ` ReentrantLock ` 。不会像 ` HashTable ` 那样不管是 ` put ` 还是 ` get ` 操作都需要做同步处理,理论上 ConcurrentHashMap 支持 ` CurrencyLevel ` (Segment数组数量 )的线程并发。每当一个线程占用锁访问一个 ` Segment ` 时,不会影响到其他的 ` Segment ` 。
12+ ` ConcurrentHashMap ` 采用了分段锁技术,其中 ` Segment ` 继承于 ` ReentrantLock ` 。不会像 ` HashTable ` 那样不管是 ` put ` 还是 ` get ` 操作都需要做同步处理,理论上 ConcurrentHashMap 支持 ` CurrencyLevel ` (Segment 数组数量 )的线程并发。每当一个线程占用锁访问一个 ` Segment ` 时,不会影响到其他的 ` Segment ` 。
1313
1414## get 方法
1515ConcurrentHashMap 的 get 方法是非常高效的,因为整个过程都不需要加锁。
You can’t perform that action at this time.
0 commit comments