Search in sources :

Example 16 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class ConfigXmlGenerator method cpSubsystemConfig.

private static void cpSubsystemConfig(XmlGenerator gen, Config config) {
    CPSubsystemConfig cpSubsystemConfig = config.getCPSubsystemConfig();
    gen.open("cp-subsystem").node("cp-member-count", cpSubsystemConfig.getCPMemberCount()).node("group-size", cpSubsystemConfig.getGroupSize()).node("session-time-to-live-seconds", cpSubsystemConfig.getSessionTimeToLiveSeconds()).node("session-heartbeat-interval-seconds", cpSubsystemConfig.getSessionHeartbeatIntervalSeconds()).node("missing-cp-member-auto-removal-seconds", cpSubsystemConfig.getMissingCPMemberAutoRemovalSeconds()).node("fail-on-indeterminate-operation-state", cpSubsystemConfig.isFailOnIndeterminateOperationState()).node("persistence-enabled", cpSubsystemConfig.isPersistenceEnabled()).node("base-dir", cpSubsystemConfig.getBaseDir().getAbsolutePath()).node("data-load-timeout-seconds", cpSubsystemConfig.getDataLoadTimeoutSeconds());
    RaftAlgorithmConfig raftAlgorithmConfig = cpSubsystemConfig.getRaftAlgorithmConfig();
    gen.open("raft-algorithm").node("leader-election-timeout-in-millis", raftAlgorithmConfig.getLeaderElectionTimeoutInMillis()).node("leader-heartbeat-period-in-millis", raftAlgorithmConfig.getLeaderHeartbeatPeriodInMillis()).node("max-missed-leader-heartbeat-count", raftAlgorithmConfig.getMaxMissedLeaderHeartbeatCount()).node("append-request-max-entry-count", raftAlgorithmConfig.getAppendRequestMaxEntryCount()).node("commit-index-advance-count-to-snapshot", raftAlgorithmConfig.getCommitIndexAdvanceCountToSnapshot()).node("uncommitted-entry-count-to-reject-new-appends", raftAlgorithmConfig.getUncommittedEntryCountToRejectNewAppends()).node("append-request-backoff-timeout-in-millis", raftAlgorithmConfig.getAppendRequestBackoffTimeoutInMillis()).close();
    gen.open("semaphores");
    for (SemaphoreConfig semaphoreConfig : cpSubsystemConfig.getSemaphoreConfigs().values()) {
        gen.open("semaphore").node("name", semaphoreConfig.getName()).node("jdk-compatible", semaphoreConfig.isJDKCompatible()).node("initial-permits", semaphoreConfig.getInitialPermits()).close();
    }
    gen.close().open("locks");
    for (FencedLockConfig lockConfig : cpSubsystemConfig.getLockConfigs().values()) {
        gen.open("fenced-lock").node("name", lockConfig.getName()).node("lock-acquire-limit", lockConfig.getLockAcquireLimit()).close();
    }
    gen.close().close();
}
Also used : RaftAlgorithmConfig(com.hazelcast.config.cp.RaftAlgorithmConfig) FencedLockConfig(com.hazelcast.config.cp.FencedLockConfig) SemaphoreConfig(com.hazelcast.config.cp.SemaphoreConfig) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig)

Example 17 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class SemaphoreAdvancedTest method createConfig.

@Override
protected Config createConfig(int cpNodeCount, int groupSize) {
    Config config = super.createConfig(cpNodeCount, groupSize);
    CPSubsystemConfig cpSubsystemConfig = config.getCPSubsystemConfig();
    cpSubsystemConfig.getRaftAlgorithmConfig().setCommitIndexAdvanceCountToSnapshot(LOG_ENTRY_COUNT_TO_SNAPSHOT);
    cpSubsystemConfig.setSessionTimeToLiveSeconds(10);
    cpSubsystemConfig.setSessionHeartbeatIntervalSeconds(1);
    SemaphoreConfig semaphoreConfig = new SemaphoreConfig();
    semaphoreConfig.setName(objectName);
    cpSubsystemConfig.addSemaphoreConfig(semaphoreConfig);
    return config;
}
Also used : SemaphoreConfig(com.hazelcast.config.cp.SemaphoreConfig) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) Config(com.hazelcast.config.Config) SemaphoreConfig(com.hazelcast.config.cp.SemaphoreConfig) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig)

Example 18 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class FencedLockAdvancedTest method createConfig.

@Override
protected Config createConfig(int cpNodeCount, int groupSize) {
    Config config = super.createConfig(cpNodeCount, groupSize);
    CPSubsystemConfig cpSubsystemConfig = config.getCPSubsystemConfig();
    cpSubsystemConfig.getRaftAlgorithmConfig().setCommitIndexAdvanceCountToSnapshot(LOG_ENTRY_COUNT_TO_SNAPSHOT);
    cpSubsystemConfig.setSessionTimeToLiveSeconds(10);
    cpSubsystemConfig.setSessionHeartbeatIntervalSeconds(1);
    return config;
}
Also used : CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) Config(com.hazelcast.config.Config) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig)

Example 19 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class UnsafeFencedLockAdvancedTest method createInstances.

@Override
protected HazelcastInstance[] createInstances() {
    Config config = new Config();
    CPSubsystemConfig cpSubsystemConfig = config.getCPSubsystemConfig();
    cpSubsystemConfig.setSessionTimeToLiveSeconds(10);
    cpSubsystemConfig.setSessionHeartbeatIntervalSeconds(1);
    return factory.newInstances(config, 2);
}
Also used : Config(com.hazelcast.config.Config) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig)

Example 20 with CPSubsystemConfig

use of com.hazelcast.config.cp.CPSubsystemConfig in project hazelcast by hazelcast.

the class HazelcastRaftTestSupport method createConfig.

protected Config createConfig(int cpNodeCount, int groupSize) {
    Config config = new Config();
    configureSplitBrainDelay(config);
    CPSubsystemConfig cpSubsystemConfig = new CPSubsystemConfig();
    config.setCPSubsystemConfig(cpSubsystemConfig);
    if (cpNodeCount > 0) {
        cpSubsystemConfig.setCPMemberCount(cpNodeCount).setGroupSize(groupSize);
    }
    return config;
}
Also used : CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig) Config(com.hazelcast.config.Config) CPSubsystemConfig(com.hazelcast.config.cp.CPSubsystemConfig)

Aggregations

CPSubsystemConfig (com.hazelcast.config.cp.CPSubsystemConfig)28 Config (com.hazelcast.config.Config)18 QuickTest (com.hazelcast.test.annotation.QuickTest)16 Test (org.junit.Test)16 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)15 ConfigValidator.checkCPSubsystemConfig (com.hazelcast.internal.config.ConfigValidator.checkCPSubsystemConfig)12 SemaphoreConfig (com.hazelcast.config.cp.SemaphoreConfig)8 FencedLockConfig (com.hazelcast.config.cp.FencedLockConfig)5 RaftAlgorithmConfig (com.hazelcast.config.cp.RaftAlgorithmConfig)4 File (java.io.File)4 KerberosAuthenticationConfig (com.hazelcast.config.security.KerberosAuthenticationConfig)3 KerberosIdentityConfig (com.hazelcast.config.security.KerberosIdentityConfig)3 LdapAuthenticationConfig (com.hazelcast.config.security.LdapAuthenticationConfig)3 RealmConfig (com.hazelcast.config.security.RealmConfig)3 SimpleAuthenticationConfig (com.hazelcast.config.security.SimpleAuthenticationConfig)3 TokenIdentityConfig (com.hazelcast.config.security.TokenIdentityConfig)2 File.createTempFile (java.io.File.createTempFile)2 CPSubsystemConfigChecker (com.hazelcast.config.ConfigCompatibilityChecker.CPSubsystemConfigChecker)1 PersistenceConfig (com.hazelcast.config.PersistenceConfig)1 JaasAuthenticationConfig (com.hazelcast.config.security.JaasAuthenticationConfig)1