类 ReplicationConnectionUrl
- java.lang.Object
-
- com.mysql.cj.conf.ConnectionUrl
-
- com.mysql.cj.conf.url.ReplicationConnectionUrl
-
- 所有已实现的接口:
DatabaseUrlContainer
public class ReplicationConnectionUrl extends ConnectionUrl
-
-
嵌套类概要
-
从类继承的嵌套类/接口 com.mysql.cj.conf.ConnectionUrl
ConnectionUrl.HostsCardinality, ConnectionUrl.Type
-
-
字段概要
-
从类继承的字段 com.mysql.cj.conf.ConnectionUrl
DEFAULT_HOST, DEFAULT_PORT, hosts, originalConnStr, originalDatabase, properties, type
-
-
构造器概要
构造器 构造器 说明 ReplicationConnectionUrl(ConnectionUrlParser connStrParser, Properties info)Constructs an instance ofReplicationConnectionUrl, performing all the required initializations.ReplicationConnectionUrl(List<HostInfo> sources, List<HostInfo> replicas, Map<String,String> properties)Constructs an instance of aReplicationConnectionUrlbased on a list of source hosts, a list of replica hosts and a global set of properties instead of connection string parsing.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 List<HostInfo>getHostsList(HostsListView view)Returns a list of the hosts in this connection URL, filtered for the given view.HostInfogetReplicaHostOrSpawnIsolated(String hostPortPair)Returns an existing replica host info with the same host:port part or spawns a new isolated host info based on this connection URL if none was found.List<HostInfo>getReplicaHostsListFromHostPortPairs(Collection<String> hostPortPairs)Returns the list ofHostInfoinstances that matches the given collection of host:port pairs in the corresponding hosts list.List<String>getReplicasListAsHostPortPairs()Returns a list of this connection URL replica hosts in the form of host:port pairs.HostInfogetSourceHostOrSpawnIsolated(String hostPortPair)Returns an existing source host info with the same host:port part or spawns a new isolated host info based on this connection URL if none was found.List<HostInfo>getSourceHostsListFromHostPortPairs(Collection<String> hostPortPairs)Returns the list ofHostInfoinstances that matches the given collection of host:port pairs in the corresponding hosts list.List<String>getSourcesListAsHostPortPairs()Returns a list of this connection URL source hosts in the form of host:port pairs.-
从类继承的方法 com.mysql.cj.conf.ConnectionUrl
acceptsUrl, buildHostInfo, collectHostsInfo, collectProperties, expandPropertiesFromConfigFiles, fixHostInfo, fixProtocolDependencies, getConnectionArgumentsAsProperties, getConnectionUrlInstance, getDatabase, getDatabaseUrl, getDefaultHost, getDefaultPassword, getDefaultPort, getDefaultUser, getHostOrSpawnIsolated, getHostOrSpawnIsolated, getHostsList, getHostsListFromDnsSrv, getMainHost, getOriginalProperties, getPropertiesFromConfigFiles, getType, hostsCount, injectPerTypeProperties, preprocessPerTypeHostProperties, replaceLegacyPropertyValues, setupPropertiesTransformer, toString
-
-
-
-
构造器详细资料
-
ReplicationConnectionUrl
public ReplicationConnectionUrl(ConnectionUrlParser connStrParser, Properties info)
Constructs an instance ofReplicationConnectionUrl, performing all the required initializations.- 参数:
connStrParser- aConnectionUrlParserinstance containing the parsed version of the original connection stringinfo- the connection arguments map
-
ReplicationConnectionUrl
public ReplicationConnectionUrl(List<HostInfo> sources, List<HostInfo> replicas, Map<String,String> properties)
Constructs an instance of aReplicationConnectionUrlbased on a list of source hosts, a list of replica hosts and a global set of properties instead of connection string parsing.ConnectionUrlinstances created by this process are not cached.- 参数:
sources- the source hosts list to use in this connection stringreplicas- the replica hosts list to use in this connection stringproperties- the properties common to all hosts
-
-
方法详细资料
-
getHostsList
public List<HostInfo> getHostsList(HostsListView view)
Returns a list of the hosts in this connection URL, filtered for the given view.- 覆盖:
getHostsList在类中ConnectionUrl- 参数:
view- the type of the view to use in the returned list of hosts.- 返回:
- the hosts list from this connection URL, filtered for the given view.
-
getSourceHostOrSpawnIsolated
public HostInfo getSourceHostOrSpawnIsolated(String hostPortPair)
Returns an existing source host info with the same host:port part or spawns a new isolated host info based on this connection URL if none was found.- 参数:
hostPortPair- the host:port part to search for- 返回:
- the existing host info or a new independent one
-
getSourcesListAsHostPortPairs
public List<String> getSourcesListAsHostPortPairs()
Returns a list of this connection URL source hosts in the form of host:port pairs.- 返回:
- a list of this connection URL source hosts in the form of host:port pairs
-
getSourceHostsListFromHostPortPairs
public List<HostInfo> getSourceHostsListFromHostPortPairs(Collection<String> hostPortPairs)
Returns the list ofHostInfoinstances that matches the given collection of host:port pairs in the corresponding hosts list. Isolated host info elements are spawned for the missing elements.- 参数:
hostPortPairs- a list of host:port pairs- 返回:
- a list of
HostInfoinstances corresponding to the given host:port pairs
-
getReplicaHostOrSpawnIsolated
public HostInfo getReplicaHostOrSpawnIsolated(String hostPortPair)
Returns an existing replica host info with the same host:port part or spawns a new isolated host info based on this connection URL if none was found.- 参数:
hostPortPair- the host:port part to search for- 返回:
- the existing host info or a new independent one
-
getReplicasListAsHostPortPairs
public List<String> getReplicasListAsHostPortPairs()
Returns a list of this connection URL replica hosts in the form of host:port pairs.- 返回:
- a list of this connection URL replica hosts in the form of host:port pairs
-
getReplicaHostsListFromHostPortPairs
public List<HostInfo> getReplicaHostsListFromHostPortPairs(Collection<String> hostPortPairs)
Returns the list ofHostInfoinstances that matches the given collection of host:port pairs in the corresponding hosts list. Isolated host info elements are spawned for the missing elements.- 参数:
hostPortPairs- a list of host:port pairs- 返回:
- a list of
HostInfoinstances corresponding to the given host:port pairs
-
-