public class QuorumConfig extends Object implements IdentifiedDataSerializable, NamedConfig
Since Hazelcast 3.5, the default built-in quorum implementation keeps track of the number of members in the cluster, as determined by Hazelcast's cluster membership management.
Since Hazelcast 3.10, two additional built-in quorum implementations, decoupled from the existing cluster membership management, are provided:
To create a QuorumConfig
for probabilistic quorum, use
newProbabilisticQuorumConfigBuilder(String, int)
to configure and build the QuorumConfig
.
To create a QuorumConfig
for recently-active quorum, use
newRecentlyActiveQuorumConfigBuilder(String, int, int)
to configure and build the
QuorumConfig
.
Constructor and Description |
---|
QuorumConfig() |
QuorumConfig(QuorumConfig quorumConfig) |
QuorumConfig(String name,
boolean enabled) |
QuorumConfig(String name,
boolean enabled,
int size) |
Modifier and Type | Method and Description |
---|---|
QuorumConfig |
addListenerConfig(QuorumListenerConfig listenerConfig) |
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier for this class.
|
List<QuorumListenerConfig> |
getListenerConfigs() |
String |
getName() |
String |
getQuorumFunctionClassName() |
QuorumFunction |
getQuorumFunctionImplementation() |
int |
getSize() |
QuorumType |
getType() |
boolean |
isEnabled() |
static ProbabilisticQuorumConfigBuilder |
newProbabilisticQuorumConfigBuilder(String name,
int size)
Returns a builder for
QuorumConfig with the given name using a probabilistic quorum function,
for the given quorum size that is enabled by default. |
static RecentlyActiveQuorumConfigBuilder |
newRecentlyActiveQuorumConfigBuilder(String name,
int size,
int toleranceMillis)
Returns a builder for a
QuorumConfig with the given name using a recently-active
quorum function for the given quorum size that is enabled by default. |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
QuorumConfig |
setEnabled(boolean enabled) |
QuorumConfig |
setListenerConfigs(List<QuorumListenerConfig> listenerConfigs) |
QuorumConfig |
setName(String name) |
QuorumConfig |
setQuorumFunctionClassName(String quorumFunctionClassName) |
QuorumConfig |
setQuorumFunctionImplementation(QuorumFunction quorumFunctionImplementation) |
QuorumConfig |
setSize(int size) |
QuorumConfig |
setType(QuorumType type) |
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public QuorumConfig()
public QuorumConfig(String name, boolean enabled)
public QuorumConfig(String name, boolean enabled, int size)
public QuorumConfig(QuorumConfig quorumConfig)
public String getName()
getName
in interface NamedConfig
public QuorumConfig setName(String name)
setName
in interface NamedConfig
public boolean isEnabled()
public QuorumConfig setEnabled(boolean enabled)
public int getSize()
public QuorumConfig setSize(int size)
public QuorumType getType()
public QuorumConfig setType(QuorumType type)
public List<QuorumListenerConfig> getListenerConfigs()
public QuorumConfig setListenerConfigs(List<QuorumListenerConfig> listenerConfigs)
public QuorumConfig addListenerConfig(QuorumListenerConfig listenerConfig)
public String getQuorumFunctionClassName()
public QuorumConfig setQuorumFunctionClassName(String quorumFunctionClassName)
public QuorumFunction getQuorumFunctionImplementation()
public QuorumConfig setQuorumFunctionImplementation(QuorumFunction quorumFunctionImplementation)
public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.public static ProbabilisticQuorumConfigBuilder newProbabilisticQuorumConfigBuilder(String name, int size)
QuorumConfig
with the given name
using a probabilistic quorum function,
for the given quorum size
that is enabled by default.name
- the quorum's namesize
- minimum count of members for quorum to be considered presentProbabilisticQuorumFunction
public static RecentlyActiveQuorumConfigBuilder newRecentlyActiveQuorumConfigBuilder(String name, int size, int toleranceMillis)
QuorumConfig
with the given name
using a recently-active
quorum function for the given quorum size
that is enabled by default.name
- the quorum's namesize
- minimum count of members for quorum to be considered presenttoleranceMillis
- maximum amount of milliseconds that may have passed since last heartbeat was received for a
member to be considered present for quorum.RecentlyActiveQuorumFunction
Copyright © 2022 Hazelcast, Inc.. All Rights Reserved.