com.hazelcast.client.config
Class ClientNetworkConfig

java.lang.Object
  extended by com.hazelcast.client.config.ClientNetworkConfig

public class ClientNetworkConfig
extends Object

Contains configuration parameters for client network related behaviour


Constructor Summary
ClientNetworkConfig()
           
 
Method Summary
 ClientNetworkConfig addAddress(String... addresses)
          Adds given addresses to candidate address list that client will use to establish initial connection
 List<String> getAddresses()
          Returns the list of candidate addresses that client will use to establish initial connection
 ClientAwsConfig getAwsConfig()
          Returns the current ClientAwsConfig.
 int getConnectionAttemptLimit()
           
 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.
 SocketInterceptorConfig getSocketInterceptorConfig()
           
 SocketOptions getSocketOptions()
           
 SSLConfig getSSLConfig()
          Returns the current SSLConfig.
 boolean isRedoOperation()
           
 boolean isSmartRouting()
           
 ClientNetworkConfig setAddresses(List<String> addresses)
          Adds given addresses to candidate address list that client will use to establish initial connection
 ClientNetworkConfig setAwsConfig(ClientAwsConfig clientAwsConfig)
          Sets configuration to connect nodes in aws environment.
 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)
           
 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 at the best effort.
 ClientNetworkConfig setSocketInterceptorConfig(SocketInterceptorConfig socketInterceptorConfig)
           
 ClientNetworkConfig setSocketOptions(SocketOptions socketOptions)
           
 ClientNetworkConfig setSSLConfig(SSLConfig sslConfig)
          Sets the SSLConfig.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientNetworkConfig

public ClientNetworkConfig()
Method Detail

isSmartRouting

public boolean isSmartRouting()
Returns:
true if client is smart
See Also:
com.hazelcast.client.config.ClientNetworkConfig#setSmartRouting(boolean)} for details

setSmartRouting

public ClientNetworkConfig setSmartRouting(boolean smartRouting)
If true, client will route the key based operations to owner of the key at the best effort. 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. 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.

Returns:
connection attempt period in millis
See Also:
ClientNetworkConfig#connectionAttemptLimit}.

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()
Returns:
connection attempt Limit
See Also:
com.hazelcast.client.config.ClientNetworkConfig#setConnectionAttemptLimit(int)} for details

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.
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)
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

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()
Returns:
true if redo operations are enabled
See Also:
com.hazelcast.client.config.ClientNetworkConfig#setRedoOperation(boolean)} for details

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. null value indicates that no AwsConfig should be used.

Parameters:
clientAwsConfig - the ClientAwsConfig
See Also:
getAwsConfig()

getAwsConfig

public ClientAwsConfig getAwsConfig()
Returns the current ClientAwsConfig. It is possible that null is returned if no SSLConfig has been

Returns:
ClientAwsConfig
See Also:
setAwsConfig(ClientAwsConfig)


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