public class ConnectionStringHostListProvider extends java.lang.Object implements StaticHostListProvider
| Modifier and Type | Field and Description |
|---|---|
static AwsWrapperProperty |
SINGLE_WRITER_CONNECTION_STRING |
| Constructor and Description |
|---|
ConnectionStringHostListProvider(@NonNull java.util.Properties properties,
java.lang.String initialUrl,
@NonNull HostListProviderService hostListProviderService) |
| 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 shouldVerifyWriter,
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.
|
HostSpec |
identifyConnection(java.sql.Connection connection) |
java.util.List<HostSpec> |
refresh() |
void |
stopMonitor() |
public static final AwsWrapperProperty SINGLE_WRITER_CONNECTION_STRING
public ConnectionStringHostListProvider(@NonNull java.util.Properties properties,
java.lang.String initialUrl,
@NonNull HostListProviderService hostListProviderService)
public java.util.List<HostSpec> getCurrentTopology(java.sql.Connection conn, HostSpec initialHostSpec) throws java.sql.SQLException
HostListProviderStaticHostListProvider. The returned topology should be fresh info returned from a topology
query if `this` is a DynamicHostListProvider,getCurrentTopology in interface HostListProviderconn - 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.public java.util.List<HostSpec> refresh() throws java.sql.SQLException
refresh in interface HostListProviderjava.sql.SQLExceptionpublic java.util.List<HostSpec> forceRefresh() throws java.sql.SQLException
HostListProviderHostListProvider.forceRefresh(boolean, long) instead.forceRefresh in interface HostListProviderjava.sql.SQLException - if there's errors updating topologypublic java.util.List<HostSpec> forceRefresh(boolean shouldVerifyWriter, long timeoutMs) throws java.sql.SQLException, java.util.concurrent.TimeoutException
HostListProviderforceRefresh in interface HostListProvidershouldVerifyWriter - a flag indicating that the provider should verify the writer before
returning the updated topology.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 topology update takes longer time than expectedpublic HostRole getHostRole(java.sql.Connection connection)
HostListProvidergetHostRole in interface HostListProviderconnection - a connection to the database instance whose role should be determinedpublic HostSpec identifyConnection(java.sql.Connection connection) throws java.sql.SQLException
identifyConnection in interface HostListProviderjava.sql.SQLExceptionpublic java.lang.String getClusterId()
throws java.lang.UnsupportedOperationException
getClusterId in interface HostListProviderjava.lang.UnsupportedOperationExceptionpublic void stopMonitor()
stopMonitor in interface HostListProvider