Package com.hazelcast.client.config
Class ClientNetworkConfig
java.lang.Object
com.hazelcast.client.config.ClientNetworkConfig
public class ClientNetworkConfig extends Object
Contains configuration parameters for client network related behaviour
-
Constructor Summary
Constructors Constructor Description ClientNetworkConfig()
ClientNetworkConfig(ClientNetworkConfig networkConfig)
-
Method Summary
Modifier and Type Method Description ClientNetworkConfig
addAddress(String... addresses)
Adds given addresses to candidate address list that client will use to establish initial connectionClientNetworkConfig
addOutboundPort(int port)
Add outbound port to the outbound port listClientNetworkConfig
addOutboundPortDefinition(String portDef)
Add outbound port definition to the outbound port definition listboolean
equals(Object o)
List<String>
getAddresses()
Returns the list of candidate addresses that client will use to establish initial connectionAutoDetectionConfig
getAutoDetectionConfig()
Returns the configuration of the Auto Detection discovery.AwsConfig
getAwsConfig()
Returns the currentAwsConfig
.AzureConfig
getAzureConfig()
Returns the currentAzureConfig
.ClientIcmpPingConfig
getClientIcmpPingConfig()
ICMP ping is used to detect if machine that a remote hazelcast member runs on alive or notClientCloudConfig
getCloudConfig()
int
getConnectionTimeout()
Timeout value in millis for nodes to accept client connection requests.DiscoveryConfig
getDiscoveryConfig()
Returns the configuration of the Hazelcast Discovery SPI and configured discovery providersEurekaConfig
getEurekaConfig()
Returns the currentEurekaConfig
.GcpConfig
getGcpConfig()
Returns the currentGcpConfig
.KubernetesConfig
getKubernetesConfig()
Returns the currentKubernetesConfig
.Collection<String>
getOutboundPortDefinitions()
Returns the outbound port definitions.Collection<Integer>
getOutboundPorts()
Returns the outbound ports.SocketInterceptorConfig
getSocketInterceptorConfig()
SocketOptions
getSocketOptions()
SSLConfig
getSSLConfig()
Returns the currentSSLConfig
.int
hashCode()
boolean
isAutoDetectionEnabled()
Any other connect configuration takes precedence over auto-discovery, so auto-discovery is enabled only when no other strategy is enabled.boolean
isRedoOperation()
SeesetRedoOperation(boolean)
for detailsboolean
isSmartRouting()
SeesetSmartRouting(boolean)
for detailsClientNetworkConfig
setAddresses(List<String> addresses)
Sets given addresses as candidate address list that client will use to establish initial connectionClientNetworkConfig
setAutoDetectionConfig(AutoDetectionConfig autoDetectionConfig)
Defines the Auto Detection configuration.ClientNetworkConfig
setAwsConfig(AwsConfig clientAwsConfig)
Sets configuration to connect nodes in AWS environment.ClientNetworkConfig
setAzureConfig(AzureConfig azureConfig)
Sets configuration to connect nodes in Azure environment.ClientNetworkConfig
setClientIcmpPingConfig(ClientIcmpPingConfig clientIcmpPingConfig)
ICMP ping is used to detect if machine that a remote hazelcast member runs on alive or notClientNetworkConfig
setCloudConfig(ClientCloudConfig cloudConfig)
ClientNetworkConfig
setConnectionTimeout(int connectionTimeoutInMillis)
ClientNetworkConfig
setDiscoveryConfig(DiscoveryConfig discoveryConfig)
Defines the Discovery Provider SPI configurationClientNetworkConfig
setEurekaConfig(EurekaConfig eurekaConfig)
Sets configuration to connect nodes in Eureka environment.ClientNetworkConfig
setGcpConfig(GcpConfig gcpConfig)
Sets configuration to connect nodes in GCP environment.ClientNetworkConfig
setKubernetesConfig(KubernetesConfig kubernetesConfig)
Sets configuration to connect nodes in Kubernetes environment.ClientNetworkConfig
setOutboundPortDefinitions(Collection<String> outboundPortDefinitions)
Set outbound port definitionsClientNetworkConfig
setOutboundPorts(Collection<Integer> outboundPorts)
Set outbond portsClientNetworkConfig
setRedoOperation(boolean redoOperation)
If true, client will redo the operations that were executing on the server and client lost the connection.ClientNetworkConfig
setSmartRouting(boolean smartRouting)
Iftrue
, client will route the key based operations to owner of the key on best-effort basis.ClientNetworkConfig
setSocketInterceptorConfig(SocketInterceptorConfig socketInterceptorConfig)
ClientNetworkConfig
setSocketOptions(SocketOptions socketOptions)
ClientNetworkConfig
setSSLConfig(SSLConfig sslConfig)
Sets theSSLConfig
.String
toString()
-
Constructor Details
-
ClientNetworkConfig
public ClientNetworkConfig() -
ClientNetworkConfig
-
-
Method Details
-
getDiscoveryConfig
Returns the configuration of the Hazelcast Discovery SPI and configured discovery providers- Returns:
- Discovery Provider SPI configuration
-
setDiscoveryConfig
Defines the Discovery Provider SPI configuration- Parameters:
discoveryConfig
- the Discovery Provider SPI configuration- Returns:
- this configuration
- Throws:
IllegalArgumentException
- if discoveryConfig is null
-
getAutoDetectionConfig
Returns the configuration of the Auto Detection discovery.- Returns:
- Configuration of Auto Detection discovery
-
isAutoDetectionEnabled
public boolean isAutoDetectionEnabled()Any other connect configuration takes precedence over auto-discovery, so auto-discovery is enabled only when no other strategy is enabled.- Returns:
- true if auto-detection is enabled
-
setAutoDetectionConfig
Defines the Auto Detection configuration.- Parameters:
autoDetectionConfig
- Auto Detection configuration- Returns:
- this configuration
- Throws:
IllegalArgumentException
- if autoDetectionConfig is null
-
isSmartRouting
public boolean isSmartRouting()SeesetSmartRouting(boolean)
for details- Returns:
- true if client is smart
-
setSmartRouting
Iftrue
, client will route the key based operations to owner of the key on best-effort basis. Note that it uses a cached version ofPartitionService.getPartitions()
and doesn't guarantee that the operation will always be executed on the owner. The cached table is updated every 10 seconds.If
smartRouting == false
, all operations will be routed to single member. Operations will need two hops if the chosen member is not owner of the key. Client will have only single open connection. Useful, if there are many clients and we want to avoid each of them connecting to each member.Default value is
true
.- Parameters:
smartRouting
- true if smart routing should be enabled.- Returns:
- configured
ClientNetworkConfig
for chaining
-
getSocketInterceptorConfig
- Returns:
- socket interceptor config that will be called with the Socket, each time client creates a connection to any Member.
-
setSocketInterceptorConfig
public ClientNetworkConfig setSocketInterceptorConfig(SocketInterceptorConfig socketInterceptorConfig)- Parameters:
socketInterceptorConfig
- will be called with the Socket, each time client creates a connection to any Member.- Returns:
- configured
ClientNetworkConfig
for chaining
-
getConnectionTimeout
public int getConnectionTimeout()Timeout value in millis for nodes to accept client connection requests.- Returns:
- connection timeout value in millis
-
setConnectionTimeout
- Parameters:
connectionTimeoutInMillis
- Timeout value in millis for nodes to accept client connection requests. A zero value means wait until connection established or an error occurs.- Returns:
- configured
ClientNetworkConfig
for chaining
-
addAddress
Adds given addresses to candidate address list that client will use to establish initial connection- Parameters:
addresses
- to be added to initial address list- Returns:
- configured
ClientNetworkConfig
for chaining
-
setAddresses
Sets given addresses as candidate address list that client will use to establish initial connection- Parameters:
addresses
- to be added to initial address list- Returns:
- configured
ClientNetworkConfig
for chaining
-
getAddresses
Returns the list of candidate addresses that client will use to establish initial connection- Returns:
- list of addresses
-
isRedoOperation
public boolean isRedoOperation()SeesetRedoOperation(boolean)
for details- Returns:
- true if redo operations are enabled
-
setRedoOperation
If true, client will redo the operations that were executing on the server and client lost the connection. This can be because of network, or simply because the member died. However it is not clear whether the application is performed or not. For idempotent operations this is harmless, but for non idempotent ones retrying can cause to undesirable effects. Note that the redo can perform on any member.If false, the operation will throw
RuntimeException
that is wrappingIOException
. TODO clear what is the exception here- Parameters:
redoOperation
- true if redo operations are enabled- Returns:
- configured
ClientNetworkConfig
for chaining
-
getSocketOptions
- Returns:
- TCP Socket options
-
setSocketOptions
- Parameters:
socketOptions
- TCP Socket options- Returns:
- configured
ClientNetworkConfig
for chaining
-
getSSLConfig
Returns the currentSSLConfig
. It is possible that null is returned if no SSLConfig has been set.- Returns:
- the SSLConfig.
- See Also:
setSSLConfig(SSLConfig)
-
setSSLConfig
Sets theSSLConfig
. null value indicates that no SSLConfig should be used.- Parameters:
sslConfig
- the SSLConfig.- Returns:
- the updated ClientNetworkConfig.
- See Also:
getSSLConfig()
-
setAwsConfig
Sets configuration to connect nodes in AWS environment.- Parameters:
clientAwsConfig
- the ClientAwsConfig- See Also:
getAwsConfig()
-
getAwsConfig
Returns the currentAwsConfig
.- Returns:
- ClientAwsConfig
- See Also:
setAwsConfig(AwsConfig)
-
setGcpConfig
Sets configuration to connect nodes in GCP environment.- Parameters:
gcpConfig
- the GcpConfig- See Also:
getGcpConfig()
-
getGcpConfig
Returns the currentGcpConfig
.- Returns:
- GcpConfig
- See Also:
setGcpConfig(GcpConfig)
-
setAzureConfig
Sets configuration to connect nodes in Azure environment.- Parameters:
azureConfig
- the AzureConfig- See Also:
getAzureConfig()
-
getAzureConfig
Returns the currentAzureConfig
.- Returns:
- AzureConfig
- See Also:
setAzureConfig(AzureConfig)
-
setKubernetesConfig
Sets configuration to connect nodes in Kubernetes environment.- Parameters:
kubernetesConfig
- the KubernetesConfig- See Also:
getKubernetesConfig()
-
getKubernetesConfig
Returns the currentKubernetesConfig
.- Returns:
- KubernetesConfig
- See Also:
setKubernetesConfig(KubernetesConfig)
-
setEurekaConfig
Sets configuration to connect nodes in Eureka environment.- Parameters:
eurekaConfig
- the EurekaConfig- See Also:
getEurekaConfig()
-
getEurekaConfig
Returns the currentEurekaConfig
.- Returns:
- EurekaConfig
- See Also:
setEurekaConfig(EurekaConfig)
-
getCloudConfig
-
setCloudConfig
-
getOutboundPortDefinitions
Returns the outbound port definitions. It is possible that null is returned if not defined.- Returns:
- list of outbound port definitions
-
getOutboundPorts
Returns the outbound ports. It is possible that null is returned if not defined.- Returns:
- list of outbound ports
-
setOutboundPortDefinitions
Set outbound port definitions- Parameters:
outboundPortDefinitions
- outbound port definitions- Returns:
- ClientNetworkConfig
-
setOutboundPorts
Set outbond ports- Parameters:
outboundPorts
- outbound ports- Returns:
- ClientNetworkConfig
-
addOutboundPort
Add outbound port to the outbound port list- Parameters:
port
- outbound port- Returns:
- ClientNetworkConfig
-
addOutboundPortDefinition
Add outbound port definition to the outbound port definition list- Parameters:
portDef
- outbound port definition- Returns:
- ClientNetworkConfig
-
getClientIcmpPingConfig
ICMP ping is used to detect if machine that a remote hazelcast member runs on alive or not- Returns:
- current configuration for client icmp ping, returns the default configuration if not set by user
-
setClientIcmpPingConfig
ICMP ping is used to detect if machine that a remote hazelcast member runs on alive or not- Parameters:
clientIcmpPingConfig
- configuration for client icmp ping- Returns:
- ClientNetworkConfig for chaining
-
equals
-
hashCode
public int hashCode() -
toString
-