public class CPSubsystemConfig extends Object
 You can check the following code snippet to see how CP Subsystem
 can be initialized by configuring only the
 setCPMemberCount(int) value. In this code,
 we set 3 to setCPMemberCount(int), and we don't
 set any value to setGroupSize(int). Therefore,
 there will be 3 CP members in CP Subsystem and each CP groups will have
 3 CP members as well.
 
     int cpMemberCount = 3;
     int apMemberCount = 2;
     int memberCount = cpMemberCount + apMemberCount;
     Config config = new Config();
     config.getCPSubsystemConfig().setCPMemberCount(cpMemberCount);
     HazelcastInstance[] instances = new HazelcastInstance[memberCount];
     for (int i = 0; i < memberCount; i++) {
         instances[i] = Hazelcast.newHazelcastInstance(config);
     }
     // update an atomic long via a CP member
     IAtomicLong cpLong = instances[0].getCPSubsystem().getAtomicLong("myLong");
     cpLong.set(10);
     // access to its value via an AP member
     cpLong = instances[cpMemberCount].getCPSubsystem().getAtomicLong("myLong");
     System.out.println(cpLong.get());
 
 
 In the following code snippet, we configure
 setCPMemberCount(int) to 5 and
 setGroupSize(int) to 3, therefore there will be 5
 CP members and CP groups will be initialized by selecting 3 random CP members
 among them.
 
     int cpMemberCount = 5;
     int apMemberCount = 2;
     int groupSize = 3;
     int memberCount = cpMemberCount + apMemberCount;
     Config config = new Config();
     config.getCPSubsystemConfig()
           .setCPMemberCount(cpMemberCount)
           .setGroupSize(groupSize);
     HazelcastInstance[] instances = new HazelcastInstance[memberCount];
     for (int i = 0; i < memberCount; i++) {
         instances[i] = Hazelcast.newHazelcastInstance(config);
     }
     // update an atomic long via a CP member
     IAtomicLong cpLong = instances[0].getCPSubsystem().getAtomicLong("myLong");
     cpLong.set(10);
     // access to its value via an AP member
     cpLong = instances[cpMemberCount].getCPSubsystem().getAtomicLong("myLong");
     System.out.println(cpLong.get());
 CPSubsystem, 
CPMember, 
CPSession| Modifier and Type | Field and Description | 
|---|---|
static String | 
CP_BASE_DIR_DEFAULT
The default directory name for storing CP data. 
 | 
static int | 
DEFAULT_DATA_LOAD_TIMEOUT_SECONDS
The default data load timeout duration for restoring CP data from disk. 
 | 
static int | 
DEFAULT_HEARTBEAT_INTERVAL_SECONDS
The default duration for the periodically-committed CP session
 heartbeats. 
 | 
static int | 
DEFAULT_MISSING_CP_MEMBER_AUTO_REMOVAL_SECONDS
The default duration to wait before automatically removing
 a missing CP member from CP Subsystem. 
 | 
static int | 
DEFAULT_SESSION_TTL_SECONDS
The default value for a CP session to be kept alive after the last
 heartbeat it has received. 
 | 
static int | 
MAX_GROUP_SIZE
The maximum number of CP members that can form a CP group. 
 | 
static int | 
MIN_GROUP_SIZE
The minimum number of CP members that can form a CP group. 
 | 
| Constructor and Description | 
|---|
CPSubsystemConfig()  | 
CPSubsystemConfig(CPSubsystemConfig config)  | 
| Modifier and Type | Method and Description | 
|---|---|
CPSubsystemConfig | 
addLockConfig(FencedLockConfig lockConfig)
Adds the  
FencedLock configuration. | 
CPSubsystemConfig | 
addSemaphoreConfig(SemaphoreConfig semaphoreConfig)
Adds the CP  
ISemaphore configuration. | 
boolean | 
equals(Object o)  | 
FencedLockConfig | 
findLockConfig(String name)
Returns the  
FencedLock configuration for the given name. | 
SemaphoreConfig | 
findSemaphoreConfig(String name)
Returns the CP  
ISemaphore configuration for the given name. | 
File | 
getBaseDir()
Returns the base directory for persisting CP data. 
 | 
int | 
getCPMemberCount()
Returns the number of CP members that will initialize CP Subsystem. 
 | 
int | 
getCPMemberPriority()
Returns the CP member priority. 
 | 
int | 
getDataLoadTimeoutSeconds()
Returns the timeout duration for CP members to restore their data from
 stable storage. 
 | 
int | 
getGroupSize()
Returns the number of CP members to form CP groups. 
 | 
Map<String,FencedLockConfig> | 
getLockConfigs()
Returns the map of  
FencedLock configurations | 
int | 
getMissingCPMemberAutoRemovalSeconds()
Returns the duration to wait before automatically removing a missing
 CP member from CP Subsystem 
 | 
RaftAlgorithmConfig | 
getRaftAlgorithmConfig()
Returns configuration options for Hazelcast's Raft consensus algorithm
 implementation 
 | 
Map<String,SemaphoreConfig> | 
getSemaphoreConfigs()
Returns the map of CP  
ISemaphore configurations | 
int | 
getSessionHeartbeatIntervalSeconds()
Returns the interval for the periodically-committed CP session
 heartbeats. 
 | 
int | 
getSessionTimeToLiveSeconds()
Returns the duration for a CP session to be kept alive
 after its last session heartbeat. 
 | 
int | 
hashCode()  | 
boolean | 
isFailOnIndeterminateOperationState()
Returns the value to determine if CP Subsystem API calls will fail when
 result of an API call becomes indeterminate. 
 | 
boolean | 
isPersistenceEnabled()
Returns whether CP Subsystem Persistence enabled on this member. 
 | 
CPSubsystemConfig | 
setBaseDir(File baseDir)
Sets the base directory for persisting CP data. 
 | 
CPSubsystemConfig | 
setCPMemberCount(int cpMemberCount)
Sets the CP member count to initialize CP Subsystem. 
 | 
CPSubsystemConfig | 
setCPMemberPriority(int cpMemberPriority)
Sets the CP member priority. 
 | 
CPSubsystemConfig | 
setDataLoadTimeoutSeconds(int dataLoadTimeoutSeconds)
Sets the timeout duration for CP members to restore their data from
 stable storage. 
 | 
CPSubsystemConfig | 
setFailOnIndeterminateOperationState(boolean failOnIndeterminateOperationState)
Sets the value to determine if CP Subsystem calls will fail when
 result of an API call becomes indeterminate. 
 | 
CPSubsystemConfig | 
setGroupSize(int groupSize)
Sets the number of CP members to form CP groups. 
 | 
CPSubsystemConfig | 
setLockConfigs(Map<String,FencedLockConfig> lockConfigs)
Sets the map of  
FencedLock configurations, mapped by config
 name. | 
CPSubsystemConfig | 
setMissingCPMemberAutoRemovalSeconds(int missingCPMemberAutoRemovalSeconds)
Sets the duration to wait before automatically removing a missing
 CP member from CP Subsystem. 
 | 
CPSubsystemConfig | 
setPersistenceEnabled(boolean persistenceEnabled)
Sets whether CP Subsystem Persistence is enabled on this member. 
 | 
CPSubsystemConfig | 
setRaftAlgorithmConfig(RaftAlgorithmConfig raftAlgorithmConfig)
Sets configuration options for Hazelcast's Raft consensus algorithm
 implementation 
 | 
CPSubsystemConfig | 
setSemaphoreConfigs(Map<String,SemaphoreConfig> semaphoreConfigs)
Sets the map of CP  
ISemaphore configurations,
 mapped by config name. | 
CPSubsystemConfig | 
setSessionHeartbeatIntervalSeconds(int sessionHeartbeatIntervalSeconds)
Sets the interval for the periodically-committed CP session heartbeats. 
 | 
CPSubsystemConfig | 
setSessionTimeToLiveSeconds(int sessionTimeToLiveSeconds)
Sets the duration for a CP session to be kept alive
 after its last session heartbeat. 
 | 
String | 
toString()  | 
public static final int DEFAULT_SESSION_TTL_SECONDS
sessionTimeToLiveSecondspublic static final int DEFAULT_HEARTBEAT_INTERVAL_SECONDS
sessionHeartbeatIntervalSecondspublic static final int MIN_GROUP_SIZE
groupSizepublic static final int MAX_GROUP_SIZE
 See groupSize
public static final int DEFAULT_MISSING_CP_MEMBER_AUTO_REMOVAL_SECONDS
missingCPMemberAutoRemovalSecondspublic static final String CP_BASE_DIR_DEFAULT
baseDirpublic static final int DEFAULT_DATA_LOAD_TIMEOUT_SECONDS
dataLoadTimeoutSecondspublic CPSubsystemConfig()
public CPSubsystemConfig(CPSubsystemConfig config)
public int getCPMemberCount()
public CPSubsystemConfig setCPMemberCount(int cpMemberCount)
MIN_GROUP_SIZE and
 groupSizepublic int getGroupSize()
cpMemberCount is 0.
 If group size is not set:
 - returns the CP member count if it is an odd number,
 - returns the CP member count - 1 if it is an even number.public CPSubsystemConfig setGroupSize(int groupSize)
MIN_GROUP_SIZE
 and MAX_GROUP_SIZE.public int getSessionTimeToLiveSeconds()
public CPSubsystemConfig setSessionTimeToLiveSeconds(int sessionTimeToLiveSeconds)
public int getSessionHeartbeatIntervalSeconds()
public CPSubsystemConfig setSessionHeartbeatIntervalSeconds(int sessionHeartbeatIntervalSeconds)
public int getMissingCPMemberAutoRemovalSeconds()
public CPSubsystemConfig setMissingCPMemberAutoRemovalSeconds(int missingCPMemberAutoRemovalSeconds)
public boolean isFailOnIndeterminateOperationState()
public CPSubsystemConfig setFailOnIndeterminateOperationState(boolean failOnIndeterminateOperationState)
public boolean isPersistenceEnabled()
public CPSubsystemConfig setPersistenceEnabled(boolean persistenceEnabled)
public File getBaseDir()
public CPSubsystemConfig setBaseDir(File baseDir)
baseDir - base directorypublic int getDataLoadTimeoutSeconds()
public CPSubsystemConfig setDataLoadTimeoutSeconds(int dataLoadTimeoutSeconds)
dataLoadTimeoutSeconds - the timeout duration for CP members to
                               restore their data from stable storagepublic CPSubsystemConfig setCPMemberPriority(int cpMemberPriority)
cpMemberPriority - can be any integer numberpublic int getCPMemberPriority()
public RaftAlgorithmConfig getRaftAlgorithmConfig()
public CPSubsystemConfig setRaftAlgorithmConfig(RaftAlgorithmConfig raftAlgorithmConfig)
public Map<String,SemaphoreConfig> getSemaphoreConfigs()
ISemaphore configurationsISemaphore configurationspublic SemaphoreConfig findSemaphoreConfig(String name)
ISemaphore configuration for the given name.
 
 The name is matched by stripping the CPGroup name from
 the given name if present.
 Returns null if there is no config found by the given name
name - name of the CP ISemaphoreISemaphore configurationpublic CPSubsystemConfig addSemaphoreConfig(SemaphoreConfig semaphoreConfig)
ISemaphore configuration. Name of the CP
 ISemaphore could optionally contain a CPGroup name,
 like "mySemaphore@group1".semaphoreConfig - the CP ISemaphore configurationpublic CPSubsystemConfig setSemaphoreConfigs(Map<String,SemaphoreConfig> semaphoreConfigs)
ISemaphore configurations,
 mapped by config name. Names could optionally contain
 a CPGroup name, such as "mySemaphore@group1".semaphoreConfigs - the CP ISemaphore config map to setpublic Map<String,FencedLockConfig> getLockConfigs()
FencedLock configurationsFencedLock configurationspublic FencedLockConfig findLockConfig(String name)
FencedLock configuration for the given name.
 
 The name is matched by stripping the CPGroup name from
 the given name if present.
 Returns null if there is no config found by the given name
name - name of the FencedLockFencedLock configurationpublic CPSubsystemConfig addLockConfig(FencedLockConfig lockConfig)
FencedLock configuration. Name of the
 FencedLock could optionally contain a CPGroup name,
 like "myLock@group1".lockConfig - the FencedLock configurationpublic CPSubsystemConfig setLockConfigs(Map<String,FencedLockConfig> lockConfigs)
FencedLock configurations, mapped by config
 name. Names could optionally contain a CPGroup name, such as
 "myLock@group1".lockConfigs - the FencedLock config map to setCopyright © 2023 Hazelcast, Inc.. All rights reserved.