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 and Description
    `ClientNetworkConfig()`
    `ClientNetworkConfig(ClientNetworkConfig networkConfig)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ClientNetworkConfig` | `addAddress(String... addresses)` Adds given addresses to candidate address list that client will use to establish initial connection
    `ClientNetworkConfig` | `addOutboundPort(int port)` Add outbound port to the outbound port list
    `ClientNetworkConfig` | `addOutboundPortDefinition(String portDef)` Add outbound port definition to the outbound port definition list
    `boolean` | `equals(Object o)`
    `List<String>` | `getAddresses()` Returns the list of candidate addresses that client will use to establish initial connection
    `ClientAwsConfig` | `getAwsConfig()` Returns the current `ClientAwsConfig`.
    `AzureConfig` | `getAzureConfig()` Returns the current `AzureConfig`.
    `ClientIcmpPingConfig` | `getClientIcmpPingConfig()` ICMP ping is used to detect if machine that a remote hazelcast member runs on alive or not
    `ClientCloudConfig` | `getCloudConfig()`
    `int` | `getConnectionAttemptLimit()` See `setConnectionAttemptLimit(int)` for details
    `int` | `getConnectionAttemptPeriod()` Period for the next attempt to find a member to connect.
    `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 providers
    `EurekaConfig` | `getEurekaConfig()` Returns the current `EurekaConfig`.
    `GcpConfig` | `getGcpConfig()` Returns the current `GcpConfig`.
    `KubernetesConfig` | `getKubernetesConfig()` Returns the current `KubernetesConfig`.
    `Collection<String>` | `getOutboundPortDefinitions()` Returns the outbound port definitions.
    `Collection<Integer>` | `getOutboundPorts()` Returns the outbound ports.
    `SocketInterceptorConfig` | `getSocketInterceptorConfig()`
    `SocketOptions` | `getSocketOptions()`
    `SSLConfig` | `getSSLConfig()` Returns the current `SSLConfig`.
    `int` | `hashCode()`
    `boolean` | `isRedoOperation()` See `setRedoOperation(boolean)` for details
    `boolean` | `isSmartRouting()` See `setSmartRouting(boolean)` for details
    `ClientNetworkConfig` | `setAddresses(List<String> addresses)` Sets given addresses as candidate address list that client will use to establish initial connection
    `ClientNetworkConfig` | `setAwsConfig(ClientAwsConfig 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 not
    `void` | `setCloudConfig(ClientCloudConfig cloudConfig)`
    `ClientNetworkConfig` | `setConnectionAttemptLimit(int connectionAttemptLimit)` While client is trying to connect initially to one of the members in the `addressList`, all might be not available.
    `ClientNetworkConfig` | `setConnectionAttemptPeriod(int connectionAttemptPeriod)` Period for the next attempt to find a member to connect.
    `ClientNetworkConfig` | `setConnectionTimeout(int connectionTimeout)`
    `void` | `setDiscoveryConfig(DiscoveryConfig discoveryConfig)` Defines the Discovery Provider SPI configuration
    `ClientNetworkConfig` | `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 definitions
    `ClientNetworkConfig` | `setOutboundPorts(Collection<Integer> outboundPorts)` Set outbond ports
    `ClientNetworkConfig` | `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)` If `true`, 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 the `SSLConfig`.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ClientNetworkConfig

          public ClientNetworkConfig()

    - #### ClientNetworkConfig

          public ClientNetworkConfig(ClientNetworkConfig networkConfig)

  - ### Method Detail

    - #### getDiscoveryConfig

          public DiscoveryConfig getDiscoveryConfig()

      Returns the configuration of the Hazelcast Discovery SPI and configured discovery providers
      Returns:
        Discovery Provider SPI configuration

    - #### setDiscoveryConfig

          public void setDiscoveryConfig(DiscoveryConfig discoveryConfig)

      Defines the Discovery Provider SPI configuration
      Parameters:
        `discoveryConfig` - the Discovery Provider SPI configuration
      Throws:
        `IllegalArgumentException` - if discoveryConfig is null

    - #### isSmartRouting

          public boolean isSmartRouting()

      See `setSmartRouting(boolean)` for details
      Returns:
        true if client is smart

    - #### setSmartRouting

          public ClientNetworkConfig setSmartRouting(boolean smartRouting)

      If `true`, client will route the key based operations to owner of the key on best-effort basis. Note that it uses a cached version of `PartitionService.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

          public SocketInterceptorConfig 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

    - #### getConnectionAttemptPeriod

          public int getConnectionAttemptPeriod()

      Period for the next attempt to find a member to connect.

      See `connectionAttemptLimit`.

      Returns:
        connection attempt period in millis

    - #### setConnectionAttemptPeriod

          public ClientNetworkConfig setConnectionAttemptPeriod(int connectionAttemptPeriod)

      Period for the next attempt to find a member to connect.
      Parameters:
        `connectionAttemptPeriod` - time to wait before another attempt in millis
      Returns:
        configured `ClientNetworkConfig` for chaining

    - #### getConnectionAttemptLimit

          public int getConnectionAttemptLimit()

      See `setConnectionAttemptLimit(int)` for details
      Returns:
        connection attempt Limit

    - #### setConnectionAttemptLimit

          public ClientNetworkConfig setConnectionAttemptLimit(int connectionAttemptLimit)

      While client is trying to connect initially to one of the members in the `addressList`, all might be not available. Instead of giving up, throwing Exception and stopping client, it will attempt to retry as much as `connectionAttemptLimit` times.
      Parameters:
        `connectionAttemptLimit` - number of times to attempt to connect A zero value means try forever. A negative value means default value
      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

          public ClientNetworkConfig setConnectionTimeout(int connectionTimeout)

      Parameters:
        `connectionTimeout` - 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

          public ClientNetworkConfig addAddress(String... addresses)

      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

          public ClientNetworkConfig setAddresses(List<String> addresses)

      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

          public List<String> getAddresses()

      Returns the list of candidate addresses that client will use to establish initial connection
      Returns:
        list of addresses

    - #### isRedoOperation

          public boolean isRedoOperation()

      See `setRedoOperation(boolean)` for details
      Returns:
        true if redo operations are enabled

    - #### setRedoOperation

          public ClientNetworkConfig setRedoOperation(boolean redoOperation)

      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 wrapping `IOException`. TODO clear what is the exception here
      Parameters:
        `redoOperation` - true if redo operations are enabled
      Returns:
        configured `ClientNetworkConfig` for chaining

    - #### getSocketOptions

          public SocketOptions getSocketOptions()

      Returns:
        TCP Socket options

    - #### setSocketOptions

          public ClientNetworkConfig setSocketOptions(SocketOptions socketOptions)

      Parameters:
        `socketOptions` - TCP Socket options
      Returns:
        configured `ClientNetworkConfig` for chaining

    - #### getSSLConfig

          public SSLConfig getSSLConfig()

      Returns the current `SSLConfig`. It is possible that null is returned if no SSLConfig has been set.
      Returns:
        the SSLConfig.
      See Also:
        `setSSLConfig(SSLConfig)`

    - #### setSSLConfig

          public ClientNetworkConfig setSSLConfig(SSLConfig sslConfig)

      Sets the `SSLConfig`. null value indicates that no SSLConfig should be used.
      Parameters:
        `sslConfig` - the SSLConfig.
      Returns:
        the updated ClientNetworkConfig.
      See Also:
        `getSSLConfig()`

    - #### setAwsConfig

          public ClientNetworkConfig setAwsConfig(ClientAwsConfig clientAwsConfig)

      Sets configuration to connect nodes in AWS environment.
      Parameters:
        `clientAwsConfig` - the ClientAwsConfig
      See Also:
        `getAwsConfig()`

    - #### getAwsConfig

          public ClientAwsConfig getAwsConfig()

      Returns the current `ClientAwsConfig`.
      Returns:
        ClientAwsConfig
      See Also:
        `setAwsConfig(ClientAwsConfig)`

    - #### setGcpConfig

          public ClientNetworkConfig setGcpConfig(GcpConfig gcpConfig)

      Sets configuration to connect nodes in GCP environment.
      Parameters:
        `gcpConfig` - the GcpConfig
      See Also:
        `getGcpConfig()`

    - #### getGcpConfig

          public GcpConfig getGcpConfig()

      Returns the current `GcpConfig`.
      Returns:
        GcpConfig
      See Also:
        `setGcpConfig(GcpConfig)`

    - #### setAzureConfig

          public ClientNetworkConfig setAzureConfig(AzureConfig azureConfig)

      Sets configuration to connect nodes in Azure environment.
      Parameters:
        `azureConfig` - the AzureConfig
      See Also:
        `getAzureConfig()`

    - #### getAzureConfig

          public AzureConfig getAzureConfig()

      Returns the current `AzureConfig`.
      Returns:
        AzureConfig
      See Also:
        `setAzureConfig(AzureConfig)`

    - #### setKubernetesConfig

          public ClientNetworkConfig setKubernetesConfig(KubernetesConfig kubernetesConfig)

      Sets configuration to connect nodes in Kubernetes environment.
      Parameters:
        `kubernetesConfig` - the KubernetesConfig
      See Also:
        `getKubernetesConfig()`

    - #### getKubernetesConfig

          public KubernetesConfig getKubernetesConfig()

      Returns the current `KubernetesConfig`.
      Returns:
        KubernetesConfig
      See Also:
        `setKubernetesConfig(KubernetesConfig)`

    - #### setEurekaConfig

          public ClientNetworkConfig setEurekaConfig(EurekaConfig eurekaConfig)

      Sets configuration to connect nodes in Eureka environment.
      Parameters:
        `eurekaConfig` - the EurekaConfig
      See Also:
        `getEurekaConfig()`

    - #### getEurekaConfig

          public EurekaConfig getEurekaConfig()

      Returns the current `EurekaConfig`.
      Returns:
        EurekaConfig
      See Also:
        `setEurekaConfig(EurekaConfig)`

    - #### getCloudConfig

          public ClientCloudConfig getCloudConfig()

    - #### setCloudConfig

          public void setCloudConfig(ClientCloudConfig cloudConfig)

    - #### getOutboundPortDefinitions

          public Collection<String> getOutboundPortDefinitions()

      Returns the outbound port definitions. It is possible that null is returned if not defined.
      Returns:
        list of outbound port definitions

    - #### getOutboundPorts

          public Collection<Integer> getOutboundPorts()

      Returns the outbound ports. It is possible that null is returned if not defined.
      Returns:
        list of outbound ports

    - #### setOutboundPortDefinitions

          public ClientNetworkConfig setOutboundPortDefinitions(Collection<String> outboundPortDefinitions)

      Set outbound port definitions
      Parameters:
        `outboundPortDefinitions` - outbound port definitions
      Returns:
        ClientNetworkConfig

    - #### setOutboundPorts

          public ClientNetworkConfig setOutboundPorts(Collection<Integer> outboundPorts)

      Set outbond ports
      Parameters:
        `outboundPorts` - outbound ports
      Returns:
        ClientNetworkConfig

    - #### addOutboundPort

          public ClientNetworkConfig addOutboundPort(int port)

      Add outbound port to the outbound port list
      Parameters:
        `port` - outbound port
      Returns:
        ClientNetworkConfig

    - #### addOutboundPortDefinition

          public ClientNetworkConfig addOutboundPortDefinition(String portDef)

      Add outbound port definition to the outbound port definition list
      Parameters:
        `portDef` - outbound port definition
      Returns:
        ClientNetworkConfig

    - #### getClientIcmpPingConfig

          public ClientIcmpPingConfig 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

          public ClientNetworkConfig setClientIcmpPingConfig(ClientIcmpPingConfig clientIcmpPingConfig)

      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

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2019. All rights reserved.