Grokking Java Intermediate
Vote

0% completed

​

ConcurrentHashMap Internals

Four threads count visits to one web page. Each thread records 200,000 visits, so the correct total is 800,000. Here is one real result from a program in this lesson:

Expected total: 800000 HashMap, get then put: 221627 ConcurrentHashMap, get then put: 306233 ConcurrentHashMap, merge: 800000

Two totals are wrong, and one of them comes from ConcurrentHashMap. This class makes each single operation thread-safe, but it does not make several separate calls act as one operation.

This lesson explains how `ConcurrentHashMap

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content