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 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.
|
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 verifyTopology, long timeoutMs) throws java.sql.SQLException, java.util.concurrent.TimeoutException
HostListProviderforceRefresh in interface HostListProviderverifyTopology - 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 hitpublic java.lang.String getClusterId()
throws java.lang.UnsupportedOperationException
getClusterId in interface HostListProviderjava.lang.UnsupportedOperationExceptionpublic void stopMonitor()
stopMonitor in interface HostListProvider