What the poster wants to ask is whether ConcurrentHashMap will block the put operation when getting?
No because the array of ConcurrentHashMap is declared like this: transient volatile Node<K,V>[] table; The get operation just reads the current table array: tab = table. There is no lock.
I don’t understand what the poster wants to ask.
Synchronize or use ThreadLocal
ConcurrentHashMap is thread-safe, whether it is put or get
What the poster wants to ask is whether ConcurrentHashMap will block the put operation when getting?
No
because the array of ConcurrentHashMap is declared like this: transient volatile Node<K,V>[] table;
The get operation just reads the current table array: tab = table. There is no lock.
So it will not block the put operation