Top Fields Constructors Methods
com.mysql.cj.conf.url

public Class ReplicationConnectionUrl

extends ConnectionUrl
Class Inheritance
Imports
java.util.ArrayList, .Collection, .Collections, .LinkedList, .List, .Map, .Properties, java.util.stream.Collectors, com.mysql.cj.conf.ConnectionUrl, .ConnectionUrlParser, .HostInfo, .HostsListView, .PropertyKey

Field Summary

Modifier and TypeField and Description
private List<HostInfo>
private List<HostInfo>
private static final String
private static final String
Inherited from com.mysql.cj.conf.ConnectionUrl:
DEFAULT_HOSTDEFAULT_PORThostsoriginalConnStroriginalDatabasepropertiestype

Constructor Summary

AccessConstructor and Description
public
ReplicationConnectionUrl(ConnectionUrlParser
a ConnectionUrlParser instance containing the parsed version of the original connection string
connStrParser
,
Properties
the connection arguments map
info
)

Constructs an instance of ReplicationConnectionUrl, performing all the required initializations.

public
ReplicationConnectionUrl(List<HostInfo>
the source hosts list to use in this connection string
sources
,
List<HostInfo>
the replica hosts list to use in this connection string
replicas
,
Map<String, String>
the properties common to all hosts
properties
)

Constructs an instance of a ReplicationConnectionUrl based on a list of source hosts, a list of replica hosts and a global set of properties instead of connection string parsing.

Method Summary

Modifier and TypeMethod and Description
public List<HostInfo>

Returns:

the hosts list from this connection URL, filtered for the given view.
getHostsList
(HostsListView
the type of the view to use in the returned list of hosts.
view
)

Overrides com.mysql.cj.conf.ConnectionUrl.getHostsList.

Returns a list of the hosts in this connection URL, filtered for the given view.

public HostInfo

Returns:

the existing host info or a new independent one
getReplicaHostOrSpawnIsolated
(String
the host:port part to search for
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.

public List<HostInfo>

Returns:

a list of HostInfo instances corresponding to the given host:port pairs
getReplicaHostsListFromHostPortPairs
(Collection<String>
a list of host:port pairs
hostPortPairs
)

Returns the list of HostInfo instances that matches the given collection of host:port pairs in the corresponding hosts list.

public List<String>

Returns:

a list of this connection URL replica hosts in the form of host:port pairs
getReplicasListAsHostPortPairs
()

Returns a list of this connection URL replica hosts in the form of host:port pairs.

public HostInfo

Returns:

the existing host info or a new independent one
getSourceHostOrSpawnIsolated
(String
the host:port part to search for
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.

public List<HostInfo>

Returns:

a list of HostInfo instances corresponding to the given host:port pairs
getSourceHostsListFromHostPortPairs
(Collection<String>
a list of host:port pairs
hostPortPairs
)

Returns the list of HostInfo instances that matches the given collection of host:port pairs in the corresponding hosts list.

public List<String>

Returns:

a list of this connection URL source hosts in the form of host:port pairs
getSourcesListAsHostPortPairs
()

Returns a list of this connection URL source hosts in the form of host:port pairs.

Inherited from com.mysql.cj.conf.ConnectionUrl:
acceptsUrlbuildHostInfocollectHostsInfocollectPropertiesexpandPropertiesFromConfigFilesfixHostInfofixProtocolDependenciesgetConnectionArgumentsAsPropertiesgetConnectionUrlInstancegetDatabasegetDatabaseUrlgetDefaultHostgetDefaultPasswordgetDefaultPortgetDefaultUsergetHostOrSpawnIsolatedgetHostOrSpawnIsolatedgetHostsListgetHostsListFromDnsSrvgetMainHostgetOriginalPropertiesgetPropertiesFromConfigFilesgetTypehostsCountinjectPerTypePropertiespreprocessPerTypeHostPropertiesreplaceLegacyPropertyValuessetupPropertiesTransformertoString

Field Detail

replicaHostsback to summary
private List<HostInfo> replicaHosts
sourceHostsback to summary
private List<HostInfo> sourceHosts
TYPE_REPLICAback to summary
private static final String TYPE_REPLICA
TYPE_SOURCEback to summary
private static final String TYPE_SOURCE

Constructor Detail

ReplicationConnectionUrlback to summary
public ReplicationConnectionUrl(ConnectionUrlParser connStrParser, Properties info)

Constructs an instance of ReplicationConnectionUrl, performing all the required initializations.

Parameters
connStrParser:ConnectionUrlParser

a ConnectionUrlParser instance containing the parsed version of the original connection string

info:Properties

the connection arguments map

ReplicationConnectionUrlback to summary
public ReplicationConnectionUrl(List<HostInfo> sources, List<HostInfo> replicas, Map<String, String> properties)

Constructs an instance of a ReplicationConnectionUrl based on a list of source hosts, a list of replica hosts and a global set of properties instead of connection string parsing. ConnectionUrl instances created by this process are not cached.

Parameters
sources:List<HostInfo>

the source hosts list to use in this connection string

replicas:List<HostInfo>

the replica hosts list to use in this connection string

properties:Map<String, String>

the properties common to all hosts

Method Detail

getHostsListback to summary
public List<HostInfo> getHostsList(HostsListView view)

Overrides com.mysql.cj.conf.ConnectionUrl.getHostsList.

Returns a list of the hosts in this connection URL, filtered for the given view.

Parameters
view:HostsListView

the type of the view to use in the returned list of hosts.

Returns:List<HostInfo>

the hosts list from this connection URL, filtered for the given view.

Annotations
@Override
getReplicaHostOrSpawnIsolatedback to summary
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.

Parameters
hostPortPair:String

the host:port part to search for

Returns:HostInfo

the existing host info or a new independent one

getReplicaHostsListFromHostPortPairsback to summary
public List<HostInfo> getReplicaHostsListFromHostPortPairs(Collection<String> hostPortPairs)

Returns the list of HostInfo instances that matches the given collection of host:port pairs in the corresponding hosts list. Isolated host info elements are spawned for the missing elements.

Parameters
hostPortPairs:Collection<String>

a list of host:port pairs

Returns:List<HostInfo>

a list of HostInfo instances corresponding to the given host:port pairs

getReplicasListAsHostPortPairsback to summary
public List<String> getReplicasListAsHostPortPairs()

Returns a list of this connection URL replica hosts in the form of host:port pairs.

Returns:List<String>

a list of this connection URL replica hosts in the form of host:port pairs

getSourceHostOrSpawnIsolatedback to summary
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.

Parameters
hostPortPair:String

the host:port part to search for

Returns:HostInfo

the existing host info or a new independent one

getSourceHostsListFromHostPortPairsback to summary
public List<HostInfo> getSourceHostsListFromHostPortPairs(Collection<String> hostPortPairs)

Returns the list of HostInfo instances that matches the given collection of host:port pairs in the corresponding hosts list. Isolated host info elements are spawned for the missing elements.

Parameters
hostPortPairs:Collection<String>

a list of host:port pairs

Returns:List<HostInfo>

a list of HostInfo instances corresponding to the given host:port pairs

getSourcesListAsHostPortPairsback to summary
public List<String> getSourcesListAsHostPortPairs()

Returns a list of this connection URL source hosts in the form of host:port pairs.

Returns:List<String>

a list of this connection URL source hosts in the form of host:port pairs