public interface ITopologyService
It's expected that each instance of ClusterAwareConnectionProxy uses its own instance of topology service.
| Modifier and Type | Method and Description |
|---|---|
void |
addToDownHostList(HostInfo downHost)
Mark host as down.
|
void |
clear()
Clear topology service for the current cluster.
|
void |
clearAll()
Clear topology service for all clusters.
|
java.util.List<HostInfo> |
getCachedTopology()
Get cached topology.
|
java.lang.String |
getClusterId()
Returns the unique cluster identifier for topology service instance
|
java.util.Set<java.lang.String> |
getDownHosts()
Get a set of instance names that were marked down.
|
HostInfo |
getHostByName(JdbcConnection conn)
Return the
HostInfo object that is associated with a provided connection from the topology host list. |
HostInfo |
getLastUsedReaderHost()
Get details about the most recent reader that the driver has successfully connected to.
|
java.util.List<HostInfo> |
getTopology(JdbcConnection conn,
boolean forceUpdate)
Get cluster topology.
|
boolean |
isMultiWriterCluster()
Check if topology belongs to multi-writer cluster.
|
void |
removeFromDownHostList(HostInfo host)
Unmark host as down.
|
void |
setClusterId(java.lang.String clusterId)
Set unique cluster identifier for topology service instance.
|
void |
setClusterInstanceTemplate(HostInfo clusterInstanceTemplate)
Sets host details common to each instance in the cluster, including the host dns pattern.
|
void |
setLastUsedReaderHost(HostInfo reader)
Set details about the most recent reader that the driver has connected to.
|
void |
setRefreshRate(int refreshRate)
Set new topology refresh rate.
|
void setClusterId(java.lang.String clusterId)
Cluster could be accessed through different connection strings like IP address, cluster dns endpoint, instance dns endpoint, custom domain alias (CNAME), etc. Cluster Id can be any string that unique identify a cluster despite the way it's been accessed.
clusterId - Cluster unique identifier.java.lang.String getClusterId()
void setClusterInstanceTemplate(HostInfo clusterInstanceTemplate)
Examples: "?.mydomain.com", "db-instance.?.mydomain.com"
clusterInstanceTemplate - Cluster instance details including host dns pattern.java.util.List<HostInfo> getTopology(JdbcConnection conn, boolean forceUpdate) throws java.sql.SQLException
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.SQLExceptionjava.util.List<HostInfo> getCachedTopology()
HostInfo getLastUsedReaderHost()
void setLastUsedReaderHost(HostInfo reader)
reader - A reader host.HostInfo getHostByName(JdbcConnection conn)
HostInfo object that is associated with a provided connection from the topology host list.conn - A connection to database.java.util.Set<java.lang.String> getDownHosts()
void addToDownHostList(HostInfo downHost)
downHost - The HostInfo object representing the host to mark as downvoid removeFromDownHostList(HostInfo host)
host - The HostInfo object representing the host to remove from the list of down hostsboolean isMultiWriterCluster()
void setRefreshRate(int refreshRate)
refreshRate - Topology refresh rate in millis.void clearAll()
void clear()