Class TcpIpConfig
The Tcp/Ip join mechanism relies on one or more well known members. So when a new member wants to join a cluster, it will try to connect to one of the well known members. If it is able to connect, it will know about all members in the cluster and won't rely on these well known members anymore.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Pattern
A pattern for splitting member texts defined in tcp-ip configuration by comma(,) semicolon(;) space( ). -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a 'well known' member.clear()
Removes all members.final boolean
int
Returns the connection timeout.Gets a list of all the well known members.Gets the required member.final int
hashCode()
boolean
Checks if the Tcp/Ip join mechanism is enabled.setConnectionTimeoutSeconds
(int connectionTimeoutSeconds) Sets the connection timeout.setEnabled
(boolean enabled) Enables or disables the Tcp/Ip join mechanism.setMembers
(List<String> members) Sets the well known members.setRequiredMember
(String requiredMember) Sets the required member.toString()
-
Field Details
-
MEMBER_TEXT_SPLIT_PATTERN
A pattern for splitting member texts defined in tcp-ip configuration by comma(,) semicolon(;) space( ).
-
-
Constructor Details
-
TcpIpConfig
public TcpIpConfig()
-
-
Method Details
-
getConnectionTimeoutSeconds
public int getConnectionTimeoutSeconds()Returns the connection timeout.- Returns:
- the connectionTimeoutSeconds
- See Also:
-
setConnectionTimeoutSeconds
Sets the connection timeout. This is the maximum amount of time Hazelcast will try to connect to a well known member before giving up. Setting it to a too low value could mean that a member is not able to connect to a cluster. Setting it as too high a value means that member startup could slow down because of longer timeouts (e.g. when a well known member is not up).- Parameters:
connectionTimeoutSeconds
- the connection timeout in seconds- Returns:
- the updated TcpIpConfig
- Throws:
IllegalArgumentException
- if connectionTimeoutSeconds is smaller than 0- See Also:
-
isEnabled
public boolean isEnabled()Checks if the Tcp/Ip join mechanism is enabled.- Returns:
true
if enabled,false
otherwise
-
setEnabled
Enables or disables the Tcp/Ip join mechanism.- Parameters:
enabled
-true
to enable the Tcp/Ip join mechanism,false
to disable- Returns:
- TcpIpConfig the updated TcpIpConfig config
-
getMembers
Gets a list of all the well known members. If there are no well known members, the list will be empty.- Returns:
- the list members
- See Also:
-
setMembers
Sets the well known members.If members are empty, calling this method will have the same effect as calling
clear()
.A member can be a comma(,) semicolon(;) space( ) separated string, e.g. "10.11.12.1,10.11.12.2" which indicates multiple members are going to be added.
- Parameters:
members
- the members to set- Returns:
- the updated TcpIpConfig
- Throws:
IllegalArgumentException
- if members isnull
-
addMember
Adds a 'well known' member.Each HazelcastInstance will try to connect to at least one of the members, to find all other members, and create a cluster.
A member can be a comma(,) semicolon(;) space( ) separated string, e.g. "10.11.12.1,10.11.12.2" which indicates multiple members are going to be added.
- Parameters:
member
- the member to add- Returns:
- the updated configuration
- Throws:
IllegalArgumentException
- if member isnull
or empty- See Also:
-
clear
Removes all members.Can safely be called when there are no members.
- Returns:
- the updated configuration
- See Also:
-
getRequiredMember
Gets the required member. If no required member is configured, null is returned.- Returns:
- the requiredMember
- See Also:
-
setRequiredMember
Sets the required member. If a null value is passed, it means that there is no required member.With a required member configured, the cluster will only start up when this required member is up. Setting the required member can be tricky, since if that member doesn't come up, the cluster won't start.
- Parameters:
requiredMember
- the requiredMember to set- Returns:
- TcpIpConfig the updated configuration
- See Also:
-
equals
-
hashCode
public final int hashCode() -
toString
-