In Java, is it safe to change a reference to a HashMap read concurrently

前端 未结 4 999
慢半拍i
慢半拍i 2020-12-15 07:08

I hope this isn\'t too silly a question...

I have code similar to the following in my project:

public class ConfigStore {

    public static class Co         


        
4条回答
  •  旧时难觅i
    2020-12-15 07:29

    Would it work for you to use a ConcurrentHashMap and instead of swapping the entire config update the affected values in the hash map?

提交回复
热议问题