Suppose, there are three threads, who want to access same object of ConcurrentHashMap of Java (Java 7). These three threads have operation as put, remove and get respectively. Could you please help me to understand, how ConcurrentHashMap will manage to put, remove and get Map Entry (Key, Value) for same segment on same time for multiple threads in Java (Java 7)? Please specify, if there is any update in Java 8 for same.
Edit:
What is mean by segment in ConcurrentHashMap as per Java 7?
The concurrency level, which is allowed during update operations can be set by the optional concurrencyLevel constructor argument (default 16) [ ConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel) ], which is used as a hint for internal sizing, to partition ConcrrentHashMap internally, such partition is commonly known as Segment. Each segment manages it's own HashTable. The ConcurrentHashMap maintains a list of 16 segments by default.
Thanks and Regards.