Files
java-interview-lab/hashmap-vs-concurrenthashmap/output/04-forced-lost-update.txt
T

10 lines
437 B
Plaintext

Two threads, two increments, forced interleaving: read, read, write, write
==========================================================================
expected final value: 2
HashMap get + put: 1
synchronizedMap get + put: 1
ConcurrentHashMap get + put: 1
ConcurrentHashMap merge: 2
(each map call is individually thread-safe; the get-then-put PAIR is not atomic)