如果ConcurrentHashMap大小增加,concurrencyLevel会是什么?
假设ConcurrentHashMap的初始容量为16.而默认的concurrencyLevel为16.如果容量在一段时间后按负载因子增加,现在容量增加为28.在这种情况下,concurrencyLevel会是什么?
也可以通过这些链接 Segmentation in ConcurrentHashMap和Modifying values in ConcurrentHashMap,但仍然不清楚。
提前致谢。
答案 0 :(得分:7)
没有理由在阅读文档时考虑并发级别可能会发生变化。它仍然是在对象创建过程中设置的内容。 如有疑问,请浏览源代码:
如果初始容量低于指定的并发级别,目前它所做的只是增加了bin的数量。