Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 621
surendrapanday Avatar asked Mar 09 '23 22:03

surendrapanday


1 Answers

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.

like image 172
MK. Avatar answered Mar 19 '23 15:03

MK.