}
}
}
private void updateCassandraJvmProps(Configuration newConfig) throws IOException {
PropertiesFileUpdate propertiesUpdater = new PropertiesFileUpdate(jvmOptsFile.getAbsolutePath());
Properties properties = propertiesUpdater.loadExistingProperties();
String jmxPort = newConfig.getSimpleValue("jmxPort");
if (!StringUtil.isEmpty(jmxPort)) {
validateIntegerArg("jmx_port", jmxPort);
properties.setProperty("jmx_port", jmxPort);
}
String maxHeapSize = newConfig.getSimpleValue("maxHeapSize");
if (!StringUtil.isEmpty(maxHeapSize)) {
validateHeapArg("maxHeapSize", maxHeapSize);
// We want min and max heap to be the same
properties.setProperty("heap_min", "-Xms" + maxHeapSize);
properties.setProperty("heap_max", "-Xmx" + maxHeapSize);
}
String heapNewSize = newConfig.getSimpleValue("heapNewSize");
if (!StringUtil.isEmpty(heapNewSize)) {
validateHeapArg("heapNewSize", heapNewSize);
properties.setProperty("heap_new", "-Xmn" + heapNewSize);
}
String threadStackSize = newConfig.getSimpleValue("threadStackSize");
if (!StringUtil.isEmpty(threadStackSize)) {
validateIntegerArg("threadStackSize", threadStackSize);
properties.setProperty("thread_stack_size", "-Xss" + threadStackSize + "k");
}
PropertySimple heapDumpOnOMMError = newConfig.getSimple("heapDumpOnOOMError");
if (heapDumpOnOMMError != null) {
if (heapDumpOnOMMError.getBooleanValue()) {
properties.setProperty("heap_dump_on_OOMError", "-XX:+HeapDumpOnOutOfMemoryError");
} else {
properties.setProperty("heap_dump_on_OOMError", "");
}
}
String heapDumpDir = useForwardSlash(newConfig.getSimpleValue("heapDumpDir"));
if (!StringUtil.isEmpty(heapDumpDir)) {
properties.setProperty("heap_dump_dir", heapDumpDir);
}
propertiesUpdater.update(properties);
}