Reputation: 37
I'm rookie to the world of java.until.concurrent. Need an insight before applying ConcurrentHashMap in the code. Theoretically the map internally segments to 16 metamerics(Default Segmentation though can be customized). Each catering to different threads while processing. Now that there two or more threads trying to manipulate the content on the map... So how does the synchronization happens across other threads subsequently while it is being read.
Upvotes: 1
Views: 397
Reputation: 293
The synchronization is transparent to the developer. Since ConcurrentMap
interface extends the java.util.Map
, you can invoke the get/put methods on ConcurrentHashMap
as you do with HashMap
, the JVM will handle the synchronization in background transparently. You don't need to care about it.
Upvotes: 2