private String updateConfigurationValue()

in priam/src/main/java/com/netflix/priam/tuner/JVMOptionsTuner.java [137:185]


    private String updateConfigurationValue(
            final String line,
            GCType configuredGC,
            Map<String, JVMOption> upsertSet,
            Map<String, JVMOption> excludeSet) {

        JVMOption option = JVMOption.parse(line);
        if (option == null) return line;

        // Is parameter for heap setting.
        if (option.isHeapJVMOption()) {
            String configuredValue;
            switch (option.getJvmOption()) {
                    // Special handling for heap new size ("Xmn")
                case "-Xmn":
                    configuredValue = config.getHeapNewSize();
                    break;
                    // Set min and max heap size to same value
                default:
                    configuredValue = config.getHeapSize();
                    break;
            }
            setHeapSetting(configuredValue, option);
        }

        // We don't want Xmn with G1GC, allow the GC to determine optimal young gen
        if (option.getJvmOption().equals("-Xmn") && configuredGC == GCType.G1GC)
            option.setCommented(true);

        // Is parameter for GC.
        GCType gcType = GCTuner.getGCType(option);
        if (gcType != null) {
            option.setCommented(gcType != configuredGC);
        }

        // See if option is in upsert list.
        if (upsertSet != null && upsertSet.containsKey(option.getJvmOption())) {
            JVMOption configuration = upsertSet.get(option.getJvmOption());
            option.setCommented(false);
            option.setValue(configuration.getValue());
            upsertSet.remove(option.getJvmOption());
        }

        // See if option is in exclude list.
        if (excludeSet != null && excludeSet.containsKey(option.getJvmOption()))
            option.setCommented(true);

        return option.toJVMOptionString();
    }