is that thread safe to update entry.value.field directly in ConcurrentHashMap? -


sometimes, need update 1 field of entry.value. thread safe way construct new entry.value , use put method update. said, need make deep copy of original value though little modification.

can update like

map[key].field = fieldvalue; 

hash map returns entry safely, assignment of field out of scope of map. so, should here thread safety. code equivalent to:

entry entry = map[key]; entry.field = fieldvalue; 

obviously field assignment operator doesn't know map.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -