public class DefaultClientConnectionStrategy extends ClientConnectionStrategy
clientConnectionStrategyConfig, clientContext, logger| Constructor and Description |
|---|
DefaultClientConnectionStrategy() |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeConnectToCluster(Address target)
If a cluster connection is established, this method will be called.
|
void |
beforeGetConnection(Address target)
The purpose of this method is to validate a connection request by target, and exit the blocking invocation.
|
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
|
void |
onClusterConnect()
If a cluster connection is established, this method will be called.
|
void |
onConnect(ClientConnection connection)
If the
ClientConnectionManager opens a new connection to a member,
this method will be called with the connection parameter |
void |
onDisconnect(ClientConnection connection)
If a connection is disconnected, this method will be called with the connection parameter
|
void |
onDisconnectFromCluster()
If the cluster connection is lost for any reason, this method will be called.
|
void |
shutdown()
This will be called as the last step of the HazelcastClient's shutdown.
|
void |
start()
Starts the ClientConnectionStrategy; this will trigger connecting to the cluster.
|
public void init(ClientContext clientContext)
ClientConnectionStrategyinit in class ClientConnectionStrategyclientContext - hazelcast client context to access internal servicespublic void start()
ClientConnectionStrategystart in class ClientConnectionStrategypublic void beforeGetConnection(Address target)
ClientConnectionStrategyClientConnectionManager 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.beforeGetConnection in class ClientConnectionStrategytarget - address of the requested connectionpublic void beforeOpenConnection(Address target)
ClientConnectionStrategyClientConnectionManager,
this method will be called.
This request can be rejected by throwing an instance of non retryable exceptions;
IOException, HazelcastInstanceNotActiveException or
RetryableExceptionbeforeOpenConnection in class ClientConnectionStrategytarget - address of the requested connectionpublic void beforeConnectToCluster(Address target)
ClientConnectionStrategybeforeConnectToCluster in class ClientConnectionStrategytarget - address of the requested connectionpublic void onClusterConnect()
ClientConnectionStrategyonClusterConnect in class ClientConnectionStrategypublic void onDisconnectFromCluster()
ClientConnectionStrategyonDisconnectFromCluster in class ClientConnectionStrategypublic void onConnect(ClientConnection connection)
ClientConnectionStrategyClientConnectionManager opens a new connection to a member,
this method will be called with the connection parameteronConnect in class ClientConnectionStrategyconnection - the new established connectionpublic void onDisconnect(ClientConnection connection)
ClientConnectionStrategyonDisconnect in class ClientConnectionStrategyconnection - the closed connectionpublic void shutdown()
ClientConnectionStrategyshutdown in class ClientConnectionStrategyCopyright © 2020 Hazelcast, Inc.. All Rights Reserved.