@Override
    public void freeze() {
        // Freeze this
        if (unmodifiableMap==null)
            unmodifiableMap= map!=null ? Collections.unmodifiableMap(map) : Map.of();
        map=null; // just to keep the states simpler

        // Freeze content
        for (Map.Entry<String,Object> entry : unmodifiableMap.entrySet()) {
            if (entry.getValue() instanceof QueryProfile)
                ((QueryProfile)entry.getValue()).freeze();
        }
        super.freeze();
    }
Create a WRITABLE instance with some initial state
container-search/src/main/java/com/yahoo/search/query/profile/CopyOnWriteContent.java