Class NetworkConfig
- java.lang.Object
-
- com.hazelcast.config.NetworkConfig
-
- Direct Known Subclasses:
AdvancedNetworkConfig.MemberNetworkingView
public class NetworkConfig extends java.lang.Object
Contains configuration for Network.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PORT
Default value of port number.
-
Constructor Summary
Constructors Constructor Description NetworkConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description NetworkConfig
addOutboundPort(int port)
NetworkConfig
addOutboundPortDefinition(java.lang.String portDef)
boolean
equals(java.lang.Object o)
IcmpFailureDetectorConfig
getIcmpFailureDetectorConfig()
Returns the currentIcmpFailureDetectorConfig
.InterfacesConfig
getInterfaces()
JoinConfig
getJoin()
Returns theJoinConfig
.MemberAddressProviderConfig
getMemberAddressProviderConfig()
MemcacheProtocolConfig
getMemcacheProtocolConfig()
java.util.Collection<java.lang.String>
getOutboundPortDefinitions()
java.util.Collection<java.lang.Integer>
getOutboundPorts()
int
getPort()
Returns the port the Hazelcast member will try to bind on.int
getPortCount()
Returns the maximum number of ports allowed to try to bind on.java.lang.String
getPublicAddress()
RestApiConfig
getRestApiConfig()
SocketInterceptorConfig
getSocketInterceptorConfig()
Gets theSocketInterceptorConfig
.SSLConfig
getSSLConfig()
Returns the currentSSLConfig
.SymmetricEncryptionConfig
getSymmetricEncryptionConfig()
Deprecated.since 4.2TpcSocketConfig
getTpcSocketConfig()
Gets the TpcSocketConfig.int
hashCode()
boolean
isPortAutoIncrement()
Checks if a Hazelcast member is allowed find a free port by incrementing the port number when it encounters an occupied port.boolean
isReuseAddress()
NetworkConfig
setIcmpFailureDetectorConfig(IcmpFailureDetectorConfig icmpFailureDetectorConfig)
Sets theIcmpFailureDetectorConfig
.NetworkConfig
setInterfaces(InterfacesConfig interfaces)
NetworkConfig
setJoin(JoinConfig join)
NetworkConfig
setMemberAddressProviderConfig(MemberAddressProviderConfig memberAddressProviderConfig)
NetworkConfig
setMemcacheProtocolConfig(MemcacheProtocolConfig memcacheProtocolConfig)
NetworkConfig
setOutboundPortDefinitions(java.util.Collection<java.lang.String> outboundPortDefs)
NetworkConfig
setOutboundPorts(java.util.Collection<java.lang.Integer> outboundPorts)
NetworkConfig
setPort(int port)
Sets the port the Hazelcast member will try to bind on.NetworkConfig
setPortAutoIncrement(boolean portAutoIncrement)
Sets if a Hazelcast member is allowed to find a free port by incrementing the port number when it encounters an occupied port.NetworkConfig
setPortCount(int portCount)
The maximum number of ports allowed to use.NetworkConfig
setPublicAddress(java.lang.String publicAddress)
Overrides the public address of a member.NetworkConfig
setRestApiConfig(RestApiConfig restApiConfig)
NetworkConfig
setReuseAddress(boolean reuseAddress)
Sets the reuse address.NetworkConfig
setSocketInterceptorConfig(SocketInterceptorConfig socketInterceptorConfig)
Sets theSocketInterceptorConfig
.NetworkConfig
setSSLConfig(SSLConfig sslConfig)
Sets theSSLConfig
.NetworkConfig
setSymmetricEncryptionConfig(SymmetricEncryptionConfig symmetricEncryptionConfig)
Deprecated.since 4.2NetworkConfig
setTpcSocketConfig(TpcSocketConfig tpcSocketConfig)
Sets the TpcSocketConfigjava.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
Default value of port number.- See Also:
- Constant Field Values
-
-
Method Detail
-
getPort
public int getPort()
Returns the port the Hazelcast member will try to bind on. A port number of 0 will let the system pick up an ephemeral port.- Returns:
- the port the Hazelcast member will try to bind on
- See Also:
setPort(int)
-
setPort
public NetworkConfig setPort(int port)
Sets the port the Hazelcast member will try to bind on.A valid port value is between 0 and 65535. A port number of 0 will let the system pick up an ephemeral port.
- Parameters:
port
- the port the Hazelcast member will try to bind on- Returns:
- NetworkConfig the updated NetworkConfig
- See Also:
getPort()
,for more information
-
getPortCount
public int getPortCount()
Returns the maximum number of ports allowed to try to bind on.- Returns:
- the maximum number of ports allowed to try to bind on
- See Also:
setPortCount(int)
,for more information
-
setPortCount
public NetworkConfig setPortCount(int portCount)
The maximum number of ports allowed to use.- Parameters:
portCount
- the maximum number of ports allowed to use- Returns:
- this configuration
- See Also:
for more information
-
isPortAutoIncrement
public boolean isPortAutoIncrement()
Checks if a Hazelcast member is allowed find a free port by incrementing the port number when it encounters an occupied port.- Returns:
- the portAutoIncrement
- See Also:
setPortAutoIncrement(boolean)
-
setPortAutoIncrement
public NetworkConfig setPortAutoIncrement(boolean portAutoIncrement)
Sets if a Hazelcast member is allowed to find a free port by incrementing the port number when it encounters an occupied port.If you explicitly want to control the port a Hazelcast member is going to use, you probably want to set portAutoincrement to false. In this case, the Hazelcast member is going to try the port
setPort(int)
and if the port is not free, the member will not start and throw an exception.If this value is set to true, Hazelcast will start at the port specified by
setPort(int)
and will try until it finds a free port, or until it runs out of ports to trysetPortCount(int)
.- Parameters:
portAutoIncrement
- the portAutoIncrement to set- Returns:
- the updated NetworkConfig
- See Also:
isPortAutoIncrement()
,setPortCount(int)
,setPort(int)
-
isReuseAddress
public boolean isReuseAddress()
-
setReuseAddress
public NetworkConfig setReuseAddress(boolean reuseAddress)
Sets the reuse address.When should setReuseAddress(true) be used?
When the member is shutdown, the server socket port will be in TIME_WAIT state for the next 2 minutes or so. If you start the member right after shutting it down, you may not be able to bind to the same port because it is in TIME_WAIT state. if you set reuseAddress=true then TIME_WAIT will be ignored and you will be able to bind to the same port again.
This property should not be set to true on the Windows platform: see
- http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6421091
- http://www.hsc.fr/ressources/articles/win_net_srv/multiple_bindings.html
-
getOutboundPortDefinitions
public java.util.Collection<java.lang.String> getOutboundPortDefinitions()
-
setOutboundPortDefinitions
public NetworkConfig setOutboundPortDefinitions(java.util.Collection<java.lang.String> outboundPortDefs)
-
addOutboundPortDefinition
public NetworkConfig addOutboundPortDefinition(java.lang.String portDef)
-
getOutboundPorts
public java.util.Collection<java.lang.Integer> getOutboundPorts()
-
setOutboundPorts
public NetworkConfig setOutboundPorts(java.util.Collection<java.lang.Integer> outboundPorts)
-
addOutboundPort
public NetworkConfig addOutboundPort(int port)
-
getInterfaces
public InterfacesConfig getInterfaces()
- Returns:
- the interfaces
-
setInterfaces
public NetworkConfig setInterfaces(InterfacesConfig interfaces)
- Parameters:
interfaces
- the interfaces to set
-
getJoin
public JoinConfig getJoin()
Returns theJoinConfig
.- Returns:
- the join
-
setJoin
public NetworkConfig setJoin(JoinConfig join)
- Parameters:
join
- the join to set
-
getPublicAddress
public java.lang.String getPublicAddress()
-
setPublicAddress
public NetworkConfig setPublicAddress(java.lang.String publicAddress)
Overrides the public address of a member. Behind a NAT, two endpoints may not be able to see/access each other. If both nodes set their public addresses to their defined addresses on NAT, then that way they can communicate with each other. It should be set in the format “host IP address:port number”.
-
getSocketInterceptorConfig
public SocketInterceptorConfig getSocketInterceptorConfig()
Gets theSocketInterceptorConfig
. The value can benull
if no socket interception is needed.- Returns:
- the SocketInterceptorConfig
- See Also:
setSocketInterceptorConfig(SocketInterceptorConfig)
-
setSocketInterceptorConfig
public NetworkConfig setSocketInterceptorConfig(SocketInterceptorConfig socketInterceptorConfig)
Sets theSocketInterceptorConfig
. The value can benull
if no socket interception is needed.- Parameters:
socketInterceptorConfig
- the SocketInterceptorConfig to set- Returns:
- the updated NetworkConfig
-
getSymmetricEncryptionConfig
@Deprecated public SymmetricEncryptionConfig getSymmetricEncryptionConfig()
Deprecated.since 4.2Gets theSymmetricEncryptionConfig
. The value can benull
which means that no symmetric encryption should be used.- Returns:
- the SymmetricEncryptionConfig
-
setSymmetricEncryptionConfig
@Deprecated public NetworkConfig setSymmetricEncryptionConfig(SymmetricEncryptionConfig symmetricEncryptionConfig)
Deprecated.since 4.2Sets theSymmetricEncryptionConfig
. The value can benull
if no symmetric encryption should be used.- Parameters:
symmetricEncryptionConfig
- the SymmetricEncryptionConfig to set- Returns:
- the updated NetworkConfig
- See Also:
getSymmetricEncryptionConfig()
-
getSSLConfig
public SSLConfig getSSLConfig()
Returns the currentSSLConfig
. It is possible that null is returned if no SSLConfig has been set.- Returns:
- the SSLConfig
- Throws:
java.lang.SecurityException
- If a security manager exists and the calling method doesn't have correspondingHazelcastRuntimePermission
- See Also:
setSSLConfig(SSLConfig)
-
setSSLConfig
public NetworkConfig setSSLConfig(SSLConfig sslConfig)
Sets theSSLConfig
. null value indicates that no SSLConfig should be used.- Parameters:
sslConfig
- the SSLConfig- Returns:
- the updated NetworkConfig
- Throws:
java.lang.SecurityException
- If a security manager exists and the calling method doesn't have correspondingHazelcastRuntimePermission
- See Also:
getSSLConfig()
-
getMemberAddressProviderConfig
public MemberAddressProviderConfig getMemberAddressProviderConfig()
-
setMemberAddressProviderConfig
public NetworkConfig setMemberAddressProviderConfig(MemberAddressProviderConfig memberAddressProviderConfig)
-
setIcmpFailureDetectorConfig
public NetworkConfig setIcmpFailureDetectorConfig(IcmpFailureDetectorConfig icmpFailureDetectorConfig)
Sets theIcmpFailureDetectorConfig
. The value can benull
if this detector isn't needed.- Parameters:
icmpFailureDetectorConfig
- the IcmpFailureDetectorConfig to set- Returns:
- the updated NetworkConfig
- See Also:
getIcmpFailureDetectorConfig()
-
getIcmpFailureDetectorConfig
public IcmpFailureDetectorConfig getIcmpFailureDetectorConfig()
Returns the currentIcmpFailureDetectorConfig
. It is possible that null is returned if no IcmpFailureDetectorConfig has been set.- Returns:
- the IcmpFailureDetectorConfig
- See Also:
setIcmpFailureDetectorConfig(IcmpFailureDetectorConfig)
-
getRestApiConfig
public RestApiConfig getRestApiConfig()
-
setRestApiConfig
public NetworkConfig setRestApiConfig(RestApiConfig restApiConfig)
-
getMemcacheProtocolConfig
public MemcacheProtocolConfig getMemcacheProtocolConfig()
-
setMemcacheProtocolConfig
public NetworkConfig setMemcacheProtocolConfig(MemcacheProtocolConfig memcacheProtocolConfig)
-
getTpcSocketConfig
@Beta @Nonnull public TpcSocketConfig getTpcSocketConfig()
Gets the TpcSocketConfig.- Returns:
- the TpcSocketConfig
- Since:
- 5.3
- See Also:
TpcConfig
-
setTpcSocketConfig
@Beta @Nonnull public NetworkConfig setTpcSocketConfig(@Nonnull TpcSocketConfig tpcSocketConfig)
Sets the TpcSocketConfig- Parameters:
tpcSocketConfig
- the TpcSocketConfig to set- Returns:
- this network config
- Throws:
java.lang.IllegalArgumentException
- if tpcSocketConfig is null- Since:
- 5.3
- See Also:
TpcConfig
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-