目录
ConcurrentHashMap ........................................................................................................................1
预备知识 ..................................................................................................................................2
Hash ..................................................................................................................................2
位运算 ..............................................................................................................................2
1.7 中原理和实现 ....................................................................................................................3
ConcurrentHashMap 中的数据结构................................................................................3
初始化做了什么事? ......................................................................................................3
在 get 和 put 操作中,是如何快速定位元素放在哪个位置的? ................................5
get()方法 .....................................................................................................................5
put()方法 ..........................................................................................................................6
扩容操作 ..........................................................................................................................6
size 方法 ...........................................................................................................................7
弱一致性 ..........................................................................................................................7
1.8 .............................................................................................................................................7
更多的并发容器 ..............................................................................................................................7
ConcurrentSkipListMap 和 ConcurrentSkipListSet ...............................................................7
跳表 ..................................................................................................................................8
ConcurrentLinkedQueue...........................................................................................................8
写时复制容器 ..........................................................................................................................8
阻塞队列 ..........................................................................................................................................8
概念、生产者消费者模式 ......................................................................................................8
常用方法 ..................................................................................................................................8
常用阻塞队列 ..........................................................................................................................8
阻塞队列的实现原理 ..............................................................................................................9
并发容器
ConcurrentHashMap
Hashmap 多线程会导致 HashMap 的 Entry 链表形成环形数据结构,一旦形成环形数据结构,
Entry 的 next 节点永远不为空,就会产生死循环获取 Entry。
HashTable 使用 synchronized 来保证线程安全,但在线程竞争激烈的情况下 HashTable 的效
率非常低下。因为当一个线程访问 HashTable 的同步方法,其他线程也访问 HashTable 的同