Reputation: 13108
Directly from the ConcurrentHashMap javadocs:
The allowed concurrency among update operations is guided by the optional concurrencyLevel constructor argument (default 16), which is used as a hint for internal sizing. The table is internally partitioned to try to permit the indicated number of concurrent updates without contention. Because placement in hash tables is essentially random, the actual concurrency will vary.
I do not get the point when they say: "which is used as a hint for internal sizing". Should not the sizing be determing by the capacity and not by the concurrencyLevel?
Upvotes: 4
Views: 77
Reputation: 16677
the table is internally partitioned - this means they divide up the table into ConcurrencyLevel divisions in the hopes that they can do that many concurrent updates without any collisions.
there is no guarantee however that the hashed data will fall nicely in those partitions.
Upvotes: 2