public abstract class ClientConnectionStrategy extends Object
ClientConnectionManager to customize
 how client connect to cluster, and provide various behaviours like async start or restart.| Modifier and Type | Field and Description | 
|---|---|
protected ClientConnectionStrategyConfig | 
clientConnectionStrategyConfig  | 
protected ClientContext | 
clientContext  | 
protected ILogger | 
logger  | 
| Constructor and Description | 
|---|
ClientConnectionStrategy()  | 
| Modifier and Type | Method and Description | 
|---|---|
abstract void | 
beforeConnectToCluster(Address target)
If a cluster connection is established, this method will be called. 
 | 
abstract void | 
beforeGetConnection(Address target)
The purpose of this method is to validate a connection request by target, and exit the blocking invocation. 
 | 
abstract void | 
beforeOpenConnection(Address target)
If a new connection is required to open by  
ClientConnectionManager,
 this method will be called. | 
void | 
init(ClientContext clientContext)
Initialize this strategy with client context and config 
 | 
abstract void | 
onConnect(ClientConnection connection)
If the  
ClientConnectionManager opens a new connection to a member,
 this method will be called with the connection parameter | 
abstract void | 
onConnectToCluster()
If a cluster connection is established, this method will be called. 
 | 
abstract void | 
onDisconnect(ClientConnection connection)
If a connection is disconnected, this method will be called with the connection parameter 
 | 
abstract void | 
onDisconnectFromCluster()
If the cluster connection is lost for any reason, this method will be called. 
 | 
abstract void | 
shutdown()
The  
ClientConnectionManager will call this method as a last step of its shutdown. | 
abstract void | 
start()
Called after  
ClientConnectionManager started. | 
protected ClientContext clientContext
protected ILogger logger
protected ClientConnectionStrategyConfig clientConnectionStrategyConfig
public final void init(ClientContext clientContext)
clientContext - hazelcast client context to access internal servicespublic abstract void start()
ClientConnectionManager started.
 Connecting to cluster can be triggered from this method using one of
 ClientConnectionManager.connectToCluster() or
 ClientConnectionManager.connectToClusterAsync()public abstract void beforeGetConnection(Address target)
ClientConnectionManager this method will be called.
 The build in retry mechanism can be stopped by throwing an instance of non retryable exceptions;
 IOException, HazelcastInstanceNotActiveException or
 RetryableException
 The thrown exception will be received on the blocking user. Any blocking invocation will exit by that exception.target - address of the requested connectionpublic abstract void beforeOpenConnection(Address target)
ClientConnectionManager,
 this method will be called.
 This request can be rejected by throwing an instance of non retryable exceptions;
 IOException, HazelcastInstanceNotActiveException or
 RetryableExceptiontarget - address of the requested connectionpublic abstract void beforeConnectToCluster(Address target)
target - address of the requested connectionpublic abstract void onConnectToCluster()
public abstract void onDisconnectFromCluster()
public abstract void onConnect(ClientConnection connection)
ClientConnectionManager opens a new connection to a member,
 this method will be called with the connection parameterconnection - the new established connectionpublic abstract void onDisconnect(ClientConnection connection)
connection - the closed connectionpublic abstract void shutdown()
ClientConnectionManager will call this method as a last step of its shutdown.Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.