com.hazelcast.config
Class TcpIpConfig

java.lang.Object
  extended by com.hazelcast.config.TcpIpConfig

public class TcpIpConfig
extends Object

Contains the configuration for the Tcp/Ip join mechanism.

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 now about all members in the cluster and doesn't rely on these well known members anymore.


Constructor Summary
TcpIpConfig()
           
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TcpIpConfig

public TcpIpConfig()
Method Detail

getConnectionTimeoutSeconds

public int getConnectionTimeoutSeconds()
Returns the connection timeout.

Returns:
the connectionTimeoutSeconds
See Also:
setConnectionTimeoutSeconds(int)

setConnectionTimeoutSeconds

public TcpIpConfig setConnectionTimeoutSeconds(int connectionTimeoutSeconds)
Sets the connection timeout. This is the maximum amount of time Hazelcast is going to to 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 too a too high 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:
getConnectionTimeoutSeconds()

isEnabled

public boolean isEnabled()
Checks if the Tcp/Ip join mechanism is enabled.

Returns:
the enabled

setEnabled

public TcpIpConfig setEnabled(boolean enabled)
Enables or disables the Tcp/Ip join mechanism.

Parameters:
enabled - the enabled to set
Returns:
TcpIpConfig the updated TcpIpConfig config.

getMembers

public List<String> getMembers()
Gets a list of all the well known members. If there are no well known members, the list will be empty.

Returns:
the lsMembers
See Also:
setMembers(java.util.List)

setMembers

public TcpIpConfig setMembers(List<String> members)
Sets the well known members.

If members is 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.

Parameters:
members - the members to set
Returns:
the updated TcpIpConfig.
Throws:
IllegalArgumentException - if members is null.

addMember

public TcpIpConfig addMember(String member)
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 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 is null or empty.
See Also:
getMembers()

clear

public TcpIpConfig clear()
Removes all members.

Can safely be called when there are no members.

Returns:
the updated configuration.
See Also:
addMember(String)

getRequiredMember

public String getRequiredMember()
Gets the required member. If no required member is configured, null is returned.

Returns:
the requiredMember
See Also:
setRequiredMember(String)

setRequiredMember

public TcpIpConfig setRequiredMember(String requiredMember)
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:
getRequiredMember()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.