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

public Class LoadBalanceConnectionUrl

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

Field Summary

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

Constructor Summary

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

Constructs an instance of LoadBalanceConnectionUrl, performing all the required initializations and validations.

public
LoadBalanceConnectionUrl(List<HostInfo>
the hosts list to use in this connection URL
hosts
,
Map<String, String>
the properties common to all hosts
properties
)

Constructs an instance of a LoadBalanceConnectionUrl based on a list of hosts and a global set of properties instead of connection string parsing.

Method Summary

Modifier and TypeMethod and Description
public List<String>

Returns:

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

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

public List<HostInfo>

Returns:

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

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

protected void
injectPerTypeProperties(Map<String, String>
the properties already containing all known connection arguments
props
)

Overrides com.mysql.cj.conf.ConnectionUrl.injectPerTypeProperties.

Injects additional properties into the connection arguments while it's being constructed.

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

Constructor Detail

LoadBalanceConnectionUrlback to summary
public LoadBalanceConnectionUrl(ConnectionUrlParser connStrParser, Properties info)

Constructs an instance of LoadBalanceConnectionUrl, performing all the required initializations and validations. A load-balanced connection cannot deal with multiple hosts with same host:port.

Parameters
connStrParser:ConnectionUrlParser

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

info:Properties

the connection arguments map

LoadBalanceConnectionUrlback to summary
public LoadBalanceConnectionUrl(List<HostInfo> hosts, Map<String, String> properties)

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

Parameters
hosts:List<HostInfo>

the hosts list to use in this connection URL

properties:Map<String, String>

the properties common to all hosts

Method Detail

getHostInfoListAsHostPortPairsback to summary
public List<String> getHostInfoListAsHostPortPairs()

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

Returns:List<String>

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

getHostInfoListFromHostPortPairsback to summary
public List<HostInfo> getHostInfoListFromHostPortPairs(Collection<String> hostPortPairs)

Returns the list of HostInfo instances that matches the given collection of host:port pairs. 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

injectPerTypePropertiesback to summary
protected void injectPerTypeProperties(Map<String, String> props)

Overrides com.mysql.cj.conf.ConnectionUrl.injectPerTypeProperties.

Injects additional properties into the connection arguments while it's being constructed.

Parameters
props:Map<String, String>

the properties already containing all known connection arguments

Annotations
@Override