What is thread-safety how do you achieve it?

What is thread-safety how do you achieve it?
Answer
Unlike their synchronized counterparts, concurrent collections achieve thread-safety
by dividing their data into segments
. In a ConcurrentHashMap, for instance, several threads can acquire locks on different map segments, so multiple threads can access the Map at the same time.
 

Tìm kiếm

Back
Top