public class AuroraHostListProvider extends java.lang.Object implements HostListProvider, DynamicHostListProvider
| Modifier and Type | Field and Description |
|---|---|
static AwsWrapperProperty |
CLUSTER_ID |
static AwsWrapperProperty |
CLUSTER_INSTANCE_HOST_PATTERN |
static AwsWrapperProperty |
CLUSTER_TOPOLOGY_REFRESH_RATE_MS |
protected java.lang.String |
clusterId |
protected HostSpec |
clusterInstanceTemplate |
protected ConnectionUrlParser |
connectionUrlParser |
protected boolean |
isInitialized |
protected boolean |
isPrimaryClusterId |
protected static ExpiringCache<java.lang.String,software.amazon.jdbc.hostlistprovider.AuroraHostListProvider.ClusterTopologyInfo> |
topologyCache |
| Constructor and Description |
|---|
AuroraHostListProvider(java.lang.String driverProtocol,
HostListProviderService hostListProviderService,
java.util.Properties properties,
java.lang.String originalUrl) |
AuroraHostListProvider(java.lang.String driverProtocol,
HostListProviderService hostListProviderService,
java.util.Properties properties,
java.lang.String originalUrl,
ConnectionUrlParser connectionUrlParser) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear topology cache for the current cluster.
|
void |
clearAll()
Clear topology cache for all clusters.
|
java.util.List<HostSpec> |
forceRefresh() |
java.util.List<HostSpec> |
forceRefresh(java.sql.Connection connection) |
@Nullable java.util.List<HostSpec> |
getCachedTopology()
Get cached topology.
|
HostSpec |
getHostByName(java.sql.Connection conn)
Return the
HostSpec object that is associated with a provided connection from the
topology host list. |
RdsUrlType |
getRdsUrlType() |
software.amazon.jdbc.hostlistprovider.AuroraHostListProvider.FetchTopologyResult |
getTopology(java.sql.Connection conn,
boolean forceUpdate)
Get cluster topology.
|
protected void |
init() |
boolean |
isMultiWriterCluster()
Check if cached topology belongs to multi-writer cluster.
|
static void |
logCache() |
protected software.amazon.jdbc.hostlistprovider.AuroraHostListProvider.ClusterTopologyInfo |
queryForTopology(java.sql.Connection conn)
Obtain a cluster topology from database.
|
java.util.List<HostSpec> |
refresh() |
java.util.List<HostSpec> |
refresh(java.sql.Connection connection) |
protected void |
suggestPrimaryCluster(@NonNull software.amazon.jdbc.hostlistprovider.AuroraHostListProvider.ClusterTopologyInfo primaryClusterTopologyInfo) |
public static final AwsWrapperProperty CLUSTER_TOPOLOGY_REFRESH_RATE_MS
public static final AwsWrapperProperty CLUSTER_ID
public static final AwsWrapperProperty CLUSTER_INSTANCE_HOST_PATTERN
protected static final ExpiringCache<java.lang.String,software.amazon.jdbc.hostlistprovider.AuroraHostListProvider.ClusterTopologyInfo> topologyCache
protected java.lang.String clusterId
protected HostSpec clusterInstanceTemplate
protected ConnectionUrlParser connectionUrlParser
protected boolean isPrimaryClusterId
protected boolean isInitialized
public AuroraHostListProvider(java.lang.String driverProtocol,
HostListProviderService hostListProviderService,
java.util.Properties properties,
java.lang.String originalUrl)
public AuroraHostListProvider(java.lang.String driverProtocol,
HostListProviderService hostListProviderService,
java.util.Properties properties,
java.lang.String originalUrl,
ConnectionUrlParser connectionUrlParser)
protected void init()
throws java.sql.SQLException
java.sql.SQLExceptionpublic software.amazon.jdbc.hostlistprovider.AuroraHostListProvider.FetchTopologyResult getTopology(java.sql.Connection conn,
boolean forceUpdate)
throws java.sql.SQLException
refreshRateInMilliseconds).conn - A connection to database to fetch the latest topology, if needed.forceUpdate - If true, it forces a service to ignore cached copy of topology and to fetch
a fresh one.java.sql.SQLException - if errors occurred while retrieving the topology.protected void suggestPrimaryCluster(@NonNull software.amazon.jdbc.hostlistprovider.AuroraHostListProvider.ClusterTopologyInfo primaryClusterTopologyInfo)
protected software.amazon.jdbc.hostlistprovider.AuroraHostListProvider.ClusterTopologyInfo queryForTopology(java.sql.Connection conn)
throws java.sql.SQLException
conn - A connection to database to fetch the latest topology.ClusterTopologyInfo instance which contains details of the fetched topologyjava.sql.SQLException - if errors occurred while retrieving the topology.public @Nullable java.util.List<HostSpec> getCachedTopology()
public boolean isMultiWriterCluster()
public HostSpec getHostByName(java.sql.Connection conn)
HostSpec object that is associated with a provided connection from the
topology host list.conn - A connection to database.public void clearAll()
public void clear()
public java.util.List<HostSpec> refresh() throws java.sql.SQLException
refresh in interface HostListProviderjava.sql.SQLExceptionpublic java.util.List<HostSpec> refresh(java.sql.Connection connection) throws java.sql.SQLException
refresh in interface HostListProviderjava.sql.SQLExceptionpublic java.util.List<HostSpec> forceRefresh() throws java.sql.SQLException
forceRefresh in interface HostListProviderjava.sql.SQLExceptionpublic java.util.List<HostSpec> forceRefresh(java.sql.Connection connection) throws java.sql.SQLException
forceRefresh in interface HostListProviderjava.sql.SQLExceptionpublic RdsUrlType getRdsUrlType() throws java.sql.SQLException
java.sql.SQLExceptionpublic static void logCache()