1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

修复拼写错误

This commit is contained in:
tianyu94 2019-07-03 09:44:22 +08:00 committed by GitHub
parent c19d4f902b
commit 24afdffe2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,7 +284,7 @@ static class Segment<K,V> extends ReentrantLock implements Serializable {
### JDK1.8 (上面有示意图) ### JDK1.8 (上面有示意图)
ConcurrentHashMap取消了Segment分段锁采用CAS和synchronized来保证并发安全。数据结构跟HashMap1.8的结构类似,数组+链表/红黑二叉树。Java 8在链表长度超过一定阈值8时将链表寻址时间复杂度为O(N)转换为红黑树寻址时间复杂度为O(long(N)) ConcurrentHashMap取消了Segment分段锁采用CAS和synchronized来保证并发安全。数据结构跟HashMap1.8的结构类似,数组+链表/红黑二叉树。Java 8在链表长度超过一定阈值8时将链表寻址时间复杂度为O(N)转换为红黑树寻址时间复杂度为O(log(N))
synchronized只锁定当前链表或红黑二叉树的首节点这样只要hash不冲突就不会产生并发效率又提升N倍。 synchronized只锁定当前链表或红黑二叉树的首节点这样只要hash不冲突就不会产生并发效率又提升N倍。