Package com.hazelcast.config
Class PNCounterConfig
java.lang.Object
com.hazelcast.config.PNCounterConfig
- All Implemented Interfaces:
NamedConfig
,DataSerializable
,IdentifiedDataSerializable
Configuration for a
PNCounter
- Since:
- 3.10
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default number of replicas on which state for this CRDT is keptstatic final boolean
Default value for statistics enabled. -
Constructor Summary
ConstructorDescriptionPNCounterConfig
(PNCounterConfig config) PNCounterConfig
(String name) PNCounterConfig
(String name, int replicaCount, String splitBrainProtectionName, boolean statisticsEnabled) -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
Returns type identifier for this class.int
Returns DataSerializableFactory factory ID for this class.getName()
Gets the name of the PN counter.int
Returns the number of replicas on which state for this PN counter will be kept.Returns the split brain protection name for operations.int
hashCode()
boolean
Checks if statistics are enabled for this PN countervoid
Reads fields from the input streamSets the name of the PN counter.setReplicaCount
(int replicaCount) Sets the number of replicas on which state for this PN counter will be kept.setSplitBrainProtectionName
(String splitBrainProtectionName) Sets the split brain protection name for operations.setStatisticsEnabled
(boolean statisticsEnabled) Enables or disables statistics for this PN countervoid
Writes object fields to output stream
-
Field Details
-
DEFAULT_REPLICA_COUNT
public static final int DEFAULT_REPLICA_COUNTThe default number of replicas on which state for this CRDT is kept- See Also:
-
DEFAULT_STATISTICS_ENABLED
public static final boolean DEFAULT_STATISTICS_ENABLEDDefault value for statistics enabled.- See Also:
-
-
Constructor Details
-
PNCounterConfig
public PNCounterConfig() -
PNCounterConfig
-
PNCounterConfig
-
PNCounterConfig
-
-
Method Details
-
getName
Gets the name of the PN counter.- Specified by:
getName
in interfaceNamedConfig
-
setName
Sets the name of the PN counter.- Specified by:
setName
in interfaceNamedConfig
- Parameters:
name
- the name of the PN counter- Returns:
- the updated PN counter config
-
isStatisticsEnabled
public boolean isStatisticsEnabled()Checks if statistics are enabled for this PN counter- Returns:
true
if enabled,false
otherwise
-
setStatisticsEnabled
Enables or disables statistics for this PN counter- Parameters:
statisticsEnabled
-true
to enable statistics,false
to disable- Returns:
- the updated PN counter config
-
getReplicaCount
public int getReplicaCount()Returns the number of replicas on which state for this PN counter will be kept. This number applies in quiescent state, if there are currently membership changes or clusters are merging, the state may be temporarily kept on more replicas.- Returns:
- the number of replicas for the CRDT state
-
setReplicaCount
Sets the number of replicas on which state for this PN counter will be kept. This number applies in quiescent state, if there are currently membership changes or clusters are merging, the state may be temporarily kept on more replicas.The provided
replicaCount
must be between 1 and 2147483647.- Parameters:
replicaCount
- the number of replicas for the CRDT state- Returns:
- the updated PN counter config
- Throws:
InvalidConfigurationException
- if thereplicaCount
is less than 1
-
getSplitBrainProtectionName
Returns the split brain protection name for operations.- Returns:
- the split brain protection name
-
setSplitBrainProtectionName
Sets the split brain protection name for operations.- Parameters:
splitBrainProtectionName
- the split brain protection name- Returns:
- the updated PN counter config
-
getFactoryId
public int getFactoryId()Description copied from interface:IdentifiedDataSerializable
Returns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryId
in interfaceIdentifiedDataSerializable
- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializable
Returns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassId
in interfaceIdentifiedDataSerializable
- Returns:
- type ID
-
writeData
Description copied from interface:DataSerializable
Writes object fields to output stream- Specified by:
writeData
in interfaceDataSerializable
- Parameters:
out
- output- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializable
Reads fields from the input stream- Specified by:
readData
in interfaceDataSerializable
- Parameters:
in
- input- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the input stream has been closed.
-
equals
-
hashCode
public int hashCode()
-