private Object getOrCreate(ClassLocalMap globalMap) { synchronized (globalMap) { if (globalMap.containsKey(key)) { return globalMap.get(key); } else { Object init = initialValue(); globalMap.put(key, init); return init; } } }
public void setGlobal(Object o) { synchronized (globalMap) { globalMap.put(key, o); } }
public void set(Object o) { ClassLocalMap map = getLoaderLocalMap(); synchronized (map) { map.put(key, o); } }