HashMap
is not thread safe.
In my case: 1 writer thread to update the HashMap
, and N
reader thread to read from the HashMap
.
I found tha there is only 1 bad case :
- reader N read a value V1
- writer update V1 to V2
- reader N use value V1(but it is V2 now )
if in my business , we can tolerate this case, is there any other bad case?