Package com.mysql.cj.jdbc.ha.ca
Interface ReaderFailoverHandler
- All Known Implementing Classes:
ClusterAwareReaderFailoverHandler
public interface ReaderFailoverHandler
Interface for Reader Failover Process handler. This handler implements all necessary logic to try
to reconnect to another reader host.
-
Method Summary
Modifier and Type Method Description ReaderFailoverResult
failover(java.util.List<HostInfo> hosts, HostInfo currentHost)
Called to start Reader Failover Process.ReaderFailoverResult
getReaderConnection(java.util.List<HostInfo> hostList)
Called to get any available reader connection.
-
Method Details
-
failover
ReaderFailoverResult failover(java.util.List<HostInfo> hosts, HostInfo currentHost) throws java.sql.SQLExceptionCalled to start Reader Failover Process. This process tries to connect to any reader. If no reader is available then driver may also try to connect to a writer host, down hosts, and the current reader host.- Parameters:
hosts
- Cluster current topology.currentHost
- The currently connected host that has failed.- Returns:
ReaderFailoverResult
The results of this process.- Throws:
java.sql.SQLException
-
getReaderConnection
ReaderFailoverResult getReaderConnection(java.util.List<HostInfo> hostList) throws java.sql.SQLExceptionCalled to get any available reader connection. If no reader is available then result of process is unsuccessful. This process will not attempt to connect to the writer host.- Parameters:
hostList
- Cluster current topology.- Returns:
ReaderFailoverResult
The results of this process.- Throws:
java.sql.SQLException
-