public class TcpIpConfig extends Object
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.
Constructor and Description |
---|
TcpIpConfig() |
Modifier and Type | Method and Description |
---|---|
TcpIpConfig |
addMember(String member)
Adds a 'well known' member.
|
TcpIpConfig |
clear()
Removes all members.
|
int |
getConnectionTimeoutSeconds()
Returns the connection timeout.
|
List<String> |
getMembers()
Gets a list of all the well known members.
|
String |
getRequiredMember()
Gets the required member.
|
boolean |
isEnabled()
Checks if the Tcp/Ip join mechanism is enabled.
|
TcpIpConfig |
setConnectionTimeoutSeconds(int connectionTimeoutSeconds)
Sets the connection timeout.
|
TcpIpConfig |
setEnabled(boolean enabled)
Enables or disables the Tcp/Ip join mechanism.
|
TcpIpConfig |
setMembers(List<String> members)
Sets the well known members.
|
TcpIpConfig |
setRequiredMember(String requiredMember)
Sets the required member.
|
String |
toString() |
public int getConnectionTimeoutSeconds()
setConnectionTimeoutSeconds(int)
public TcpIpConfig setConnectionTimeoutSeconds(int connectionTimeoutSeconds)
connectionTimeoutSeconds
- the connection timeout in secondsIllegalArgumentException
- if connectionTimeoutSeconds is smaller than 0getConnectionTimeoutSeconds()
public boolean isEnabled()
true
if enabled, false
otherwisepublic TcpIpConfig setEnabled(boolean enabled)
enabled
- true
to enable the Tcp/Ip join mechanism, false
to disablepublic List<String> getMembers()
setMembers(java.util.List)
public TcpIpConfig setMembers(List<String> members)
If members are empty, calling this method will have the same effect as calling clear()
.
A member can be a comma separated string, e..g '10.11.12.1,10.11.12.2' which indicates multiple members are going to be added.
members
- the members to setIllegalArgumentException
- if members is null
public TcpIpConfig addMember(String 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 separated string, e..g '10.11.12.1,10.11.12.2' which indicates multiple members are going to be added.
member
- the member to addIllegalArgumentException
- if member is null
or emptygetMembers()
public TcpIpConfig clear()
Can safely be called when there are no members.
addMember(String)
public String getRequiredMember()
setRequiredMember(String)
public TcpIpConfig setRequiredMember(String requiredMember)
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.
requiredMember
- the requiredMember to setgetRequiredMember()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.