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)
ClientConnectionStrategy
init
in class ClientConnectionStrategy
clientContext
- hazelcast client context to access internal servicespublic void start()
ClientConnectionStrategy
start
in class ClientConnectionStrategy
public void beforeGetConnection(Address target)
ClientConnectionStrategy
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.beforeGetConnection
in class ClientConnectionStrategy
target
- address of the requested connectionpublic void beforeOpenConnection(Address target)
ClientConnectionStrategy
ClientConnectionManager
,
this method will be called.
This request can be rejected by throwing an instance of non retryable exceptions;
IOException
, HazelcastInstanceNotActiveException
or
RetryableException
beforeOpenConnection
in class ClientConnectionStrategy
target
- address of the requested connectionpublic void beforeConnectToCluster(Address target)
ClientConnectionStrategy
beforeConnectToCluster
in class ClientConnectionStrategy
target
- address of the requested connectionpublic void onClusterConnect()
ClientConnectionStrategy
onClusterConnect
in class ClientConnectionStrategy
public void onDisconnectFromCluster()
ClientConnectionStrategy
onDisconnectFromCluster
in class ClientConnectionStrategy
public void onConnect(ClientConnection connection)
ClientConnectionStrategy
ClientConnectionManager
opens a new connection to a member,
this method will be called with the connection parameteronConnect
in class ClientConnectionStrategy
connection
- the new established connectionpublic void onDisconnect(ClientConnection connection)
ClientConnectionStrategy
onDisconnect
in class ClientConnectionStrategy
connection
- the closed connectionpublic void shutdown()
ClientConnectionStrategy
shutdown
in class ClientConnectionStrategy
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.