public interface HostListProvider
| Modifier and Type | Method and Description |
|---|---|
java.util.List<HostSpec> |
forceRefresh()
Force a host list provider to update its topology information.
|
java.util.List<HostSpec> |
forceRefresh(boolean verifyTopology,
long timeoutMs)
Force a host list provider to update its topology information.
|
java.lang.String |
getClusterId() |
java.util.List<HostSpec> |
getCurrentTopology(java.sql.Connection conn,
HostSpec initialHostSpec)
Get current topology information for the connected database.
|
HostRole |
getHostRole(java.sql.Connection connection)
Evaluates the host role of the given connection - either a writer or a reader.
|
@Nullable HostSpec |
identifyConnection(java.sql.Connection connection) |
java.util.List<HostSpec> |
refresh() |
void |
stopMonitor() |
java.util.List<HostSpec> getCurrentTopology(java.sql.Connection conn, HostSpec initialHostSpec) throws java.sql.SQLException
StaticHostListProvider. The returned topology should be fresh info returned from a topology
query if `this` is a DynamicHostListProvider,conn - the connection to use to query the database for topology information, if needed.initialHostSpec - the host details of the initial connection.java.sql.SQLException - if an error occurs while attempting to acquire the database topology information.java.util.List<HostSpec> refresh() throws java.sql.SQLException
java.sql.SQLExceptionjava.util.List<HostSpec> forceRefresh() throws java.sql.SQLException, java.util.concurrent.TimeoutException
forceRefresh(boolean, long) instead.java.sql.SQLException - if there's errors updating topologyjava.util.concurrent.TimeoutException - if topology update takes longer time than expectedjava.util.List<HostSpec> forceRefresh(boolean verifyTopology, long timeoutMs) throws java.sql.SQLException, java.util.concurrent.TimeoutException
verifyTopology - defines whether extra measures should be taken to verify the topology. If false, the method
will return as soon as topology is successfully retrieved from any instance. If true, extra
steps are taken to verify the topology is accurate.timeoutMs - timeout in msec to wait until topology is updated or the writer is verified. If a timeout of
0 is provided, a topology update will be initiated but cached topology will be returned. If a
non-zero timeout is provided and the timeout is hit, a TimeoutException will be thrown.java.sql.SQLException - if there's errors updating topologyjava.util.concurrent.TimeoutException - if the timeout is hitHostRole getHostRole(java.sql.Connection connection) throws java.sql.SQLException
connection - a connection to the database instance whose role should be determinedjava.sql.SQLException - if there is a problem executing or processing the SQL query used to
determine the host role@Nullable HostSpec identifyConnection(java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLExceptionjava.lang.String getClusterId()
throws java.lang.UnsupportedOperationException,
java.sql.SQLException
java.lang.UnsupportedOperationExceptionjava.sql.SQLExceptionvoid stopMonitor()