public class DefaultClientConnectionStrategy extends ClientConnectionStrategy
clientConnectionStrategyConfig, clientContext, logger
Constructor and Description |
---|
DefaultClientConnectionStrategy() |
Modifier and Type | Method and Description |
---|---|
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 |
onConnect(ClientConnection connection)
If the
ClientConnectionManager opens a new connection to a member,
this method will be called with the connection parameter |
void |
onConnectToCluster()
If a cluster connection is established, this method will be called.
|
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 |
onHeartbeatResumed(ClientConnection connection)
The
ClientConnectionManager will inform this method that the provided connection's heartbeat resumed |
void |
onHeartbeatStopped(ClientConnection connection)
The
ClientConnectionManager will inform this method that the provided connection's heartbeat stopped |
void |
shutdown()
The
ClientConnectionManager will call this method as a last step of its shutdown. |
void |
start()
Called after
ClientConnectionManager started. |
init
public void start()
ClientConnectionStrategy
ClientConnectionManager
started.
Connecting to cluster can be triggered from this method using one of
ClientConnectionManager.connectToCluster()
or
ClientConnectionManager.connectToClusterAsync()
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 onConnectToCluster()
ClientConnectionStrategy
onConnectToCluster
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 onHeartbeatStopped(ClientConnection connection)
ClientConnectionStrategy
ClientConnectionManager
will inform this method that the provided connection's heartbeat stoppedonHeartbeatStopped
in class ClientConnectionStrategy
connection
- the connection that heartbeat failedpublic void onHeartbeatResumed(ClientConnection connection)
ClientConnectionStrategy
ClientConnectionManager
will inform this method that the provided connection's heartbeat resumedonHeartbeatResumed
in class ClientConnectionStrategy
connection
- the connection that heartbeat resumedpublic void shutdown()
ClientConnectionStrategy
ClientConnectionManager
will call this method as a last step of its shutdown.shutdown
in class ClientConnectionStrategy
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.