use of com.hazelcast.config.PersistentMemoryMode in project hazelcast by hazelcast.
the class AbstractDomConfigProcessor method handlePersistentMemoryConfig.
private void handlePersistentMemoryConfig(PersistentMemoryConfig persistentMemoryConfig, Node node) {
Node enabledNode = getNamedItemNode(node, "enabled");
if (enabledNode != null) {
boolean enabled = getBooleanValue(getTextContent(enabledNode));
persistentMemoryConfig.setEnabled(enabled);
}
final Node modeNode = getNamedItemNode(node, "mode");
final String modeStr = getTextContent(modeNode);
PersistentMemoryMode mode = PersistentMemoryMode.MOUNTED;
if (!StringUtil.isNullOrEmptyAfterTrim(modeStr)) {
try {
mode = PersistentMemoryMode.valueOf(modeStr);
persistentMemoryConfig.setMode(mode);
} catch (Exception ex) {
throw new InvalidConfigurationException("Invalid 'mode' for 'persistent-memory': " + modeStr);
}
}
for (Node parent : childElements(node)) {
final String nodeName = cleanNodeName(parent);
if (matches("directories", nodeName)) {
if (PersistentMemoryMode.SYSTEM_MEMORY == mode) {
throw new InvalidConfigurationException("Directories for 'persistent-memory' should only be" + " defined if the 'mode' is set to '" + PersistentMemoryMode.MOUNTED.name() + "'");
}
for (Node dirNode : childElements(parent)) {
handlePersistentMemoryDirectory(persistentMemoryConfig, dirNode);
}
}
}
}
Aggregations