简体   繁体   中英

concurrencyLevel in ConcurrentHashMap

What will be the concurrencyLevel if ConcurrentHashMap size increased?

Suppose initial capacity of ConcurrentHashMap is 16. and default concurrencyLevel will 16. If capacity increased by load factor after some time and now increased capacity is 28. What will be the concurrencyLevel in this case?

Gone through with these links as well Segmentation in ConcurrentHashMap and Modifying values in ConcurrentHashMap but still not clear.

Thanks in advance.

There is no reason to think upon reading the documentation that concurrency level can ever change. It remains what it is set to during object creation. When in doubt, browse the source code:

http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/43cb25339b55/src/share/classes/java/util/concurrent/ConcurrentHashMap.java

it seems that currently all it does is raises the number of bins if initial capacity is less than specified concurrency level.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM