use of com.hazelcast.config.HotRestartPersistenceConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testHotRestart.
@Test
public void testHotRestart() {
File dir = new File("/mnt/hot-restart/");
File hotBackupDir = new File("/mnt/hot-backup/");
HotRestartPersistenceConfig hotRestartPersistenceConfig = config.getHotRestartPersistenceConfig();
assertTrue(hotRestartPersistenceConfig.isEnabled());
assertEquals(dir.getAbsolutePath(), hotRestartPersistenceConfig.getBaseDir().getAbsolutePath());
assertEquals(hotBackupDir.getAbsolutePath(), hotRestartPersistenceConfig.getBackupDir().getAbsolutePath());
assertEquals(1111, hotRestartPersistenceConfig.getValidationTimeoutSeconds());
assertEquals(2222, hotRestartPersistenceConfig.getDataLoadTimeoutSeconds());
assertEquals(PARTIAL_RECOVERY_MOST_COMPLETE, hotRestartPersistenceConfig.getClusterDataRecoveryPolicy());
}
use of com.hazelcast.config.HotRestartPersistenceConfig in project hazelcast by hazelcast.
the class PersistenceAndHotRestartPersistenceMergerTest method test.
private void test(String template) {
String xml = String.format(template, persistenceEnabled, directory, parallelism, hotRestartPersistenceEnabled, directory + "a", max(parallelism - 1, parallelism + 1));
Config cfg = Config.loadFromString(xml);
HotRestartPersistenceConfig hotRestartPersistenceConfig = cfg.getHotRestartPersistenceConfig();
PersistenceConfig persistenceConfig = cfg.getPersistenceConfig();
assertEquals(persistenceEnabled || hotRestartPersistenceEnabled, persistenceConfig.isEnabled());
assertEquals(new File(expectedDirectory).getAbsolutePath(), persistenceConfig.getBaseDir().getAbsolutePath());
assertEquals(expectedParallelism, persistenceConfig.getParallelism());
assertEquals(persistenceEnabled || hotRestartPersistenceEnabled, hotRestartPersistenceConfig.isEnabled());
assertEquals(new File(expectedDirectory).getAbsolutePath(), hotRestartPersistenceConfig.getBaseDir().getAbsolutePath());
assertEquals(expectedParallelism, hotRestartPersistenceConfig.getParallelism());
}
use of com.hazelcast.config.HotRestartPersistenceConfig in project hazelcast by hazelcast.
the class MemberDomConfigProcessor method handleHotRestartPersistence.
private void handleHotRestartPersistence(Node hrRoot) throws Exception {
HotRestartPersistenceConfig hrConfig = config.getHotRestartPersistenceConfig().setEnabled(getBooleanValue(getAttribute(hrRoot, "enabled")));
String parallelismName = "parallelism";
String validationTimeoutName = "validation-timeout-seconds";
String dataLoadTimeoutName = "data-load-timeout-seconds";
for (Node n : childElements(hrRoot)) {
String name = cleanNodeName(n);
if (matches("encryption-at-rest", name)) {
handleEncryptionAtRest(n, hrConfig);
} else {
if (matches("base-dir", name)) {
hrConfig.setBaseDir(new File(getTextContent(n)).getAbsoluteFile());
} else if (matches("backup-dir", name)) {
hrConfig.setBackupDir(new File(getTextContent(n)).getAbsoluteFile());
} else if (matches(parallelismName, name)) {
hrConfig.setParallelism(getIntegerValue(parallelismName, getTextContent(n)));
} else if (matches(validationTimeoutName, name)) {
hrConfig.setValidationTimeoutSeconds(getIntegerValue(validationTimeoutName, getTextContent(n)));
} else if (matches(dataLoadTimeoutName, name)) {
hrConfig.setDataLoadTimeoutSeconds(getIntegerValue(dataLoadTimeoutName, getTextContent(n)));
} else if (matches("cluster-data-recovery-policy", name)) {
hrConfig.setClusterDataRecoveryPolicy(HotRestartClusterDataRecoveryPolicy.valueOf(upperCaseInternal(getTextContent(n))));
} else if (matches("auto-remove-stale-data", name)) {
hrConfig.setAutoRemoveStaleData(getBooleanValue(getTextContent(n)));
}
}
}
config.setHotRestartPersistenceConfig(hrConfig);
}
Aggregations