is
final Map<Integer,Map<String,Integer>> status = new ConcurrentHashMap<Integer, Map<String,Integer>>();
Map<Integer,Map<String,Integer>> statusInner = new ConcurrentHashMap<Integer, Map<String,Integer>>();
status.put(key,statusInner);
такой же как
volatile Map<Integer,Map<String,Integer>> status = new ConcurrentHashMap<Integer, Map<String,Integer>>();
Map<Integer,Map<String,Integer>> statusInner = new ConcurrentHashMap<Integer, Map<String,Integer>>();
status.put(key,statusInner);
в случае, если к внутренней карте обращаются разные потоки?
или даже что-то вроде этого требуется:
volatile Map<Integer,Map<String,Integer>> status = new ConcurrentHashMap<Integer, Map<String,Integer>>();
volatile Map<Integer,Map<String,Integer>> statusInner = new ConcurrentHashMap<Integer, Map<String,Integer>>();
status.put(key,statusInner);
В случае, если это НЕ «каскадная» карта, final и volatile в конечном итоге имеют тот же эффект, что и все потоки всегда видят правильное содержимое карты... Но что произойдет, если сама карта содержит карту, как в примере... Как мне убедиться, что внутренняя карта правильно "заблокирована памятью"?
Танки! Том