Reputation: 27173
I have been going through the java.util.concurrent package and trying to understand what the library provides to us . I came across CopyOnWriteArrayList
and ConcurrentHashMap
classes and trying to find how these clases achieve thread safety . For CopyOnWriteArrayList
it is pretty much intuitive and they are implemented by making a fresh copy of the underlying array whenever there is a write operation . However I am not able to understand the bigger picture of how the ConcurrentHashMap
achieves thread safety , providing concurrency at the same time ?
Edit : It would be enough if anyone can tell me the concepts that goes behind the implementation . Taking that in mind I can delve more into the source code and thus will help me in understanding it in a better way and structured manner.
Upvotes: 1
Views: 685
Reputation: 3170
if you really want to understand the way how to build concurrent hash map, i can advice to take a look into IBM article http://www.ibm.com/developerworks/java/library/j-jtp08223/
Upvotes: 5