Class ReplicationConnectionUrl

java.lang.Object
com.mysql.cj.conf.ConnectionUrl
com.mysql.cj.conf.url.ReplicationConnectionUrl
All Implemented Interfaces:
DatabaseUrlContainer

public class ReplicationConnectionUrl
extends ConnectionUrl
  • Constructor Details

    • ReplicationConnectionUrl

      public ReplicationConnectionUrl​(ConnectionUrlParser connStrParser, java.util.Properties info)
      Constructs an instance of ReplicationConnectionUrl, performing all the required initializations.
      Parameters:
      connStrParser - a ConnectionUrlParser instance containing the parsed version of the original connection string
      info - the connection arguments map
    • ReplicationConnectionUrl

      public ReplicationConnectionUrl​(java.util.List<HostInfo> sources, java.util.List<HostInfo> replicas, java.util.Map<java.lang.String,​java.lang.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 - the source hosts list to use in this connection string
      replicas - the replica hosts list to use in this connection string
      properties - the properties common to all hosts
  • Method Details

    • getHostsList

      public java.util.List<HostInfo> getHostsList​(HostsListView view)
      Returns a list of the hosts in this connection URL, filtered for the given view.
      Overrides:
      getHostsList in class ConnectionUrl
      Parameters:
      view - the type of the view to use in the returned list of hosts.
      Returns:
      the hosts list from this connection URL, filtered for the given view.
    • getSourceHostOrSpawnIsolated

      public HostInfo getSourceHostOrSpawnIsolated​(java.lang.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 - the host:port part to search for
      Returns:
      the existing host info or a new independent one
    • getSourcesListAsHostPortPairs

      public java.util.List<java.lang.String> getSourcesListAsHostPortPairs()
      Returns a list of this connection URL source hosts in the form of host:port pairs.
      Returns:
      a list of this connection URL source hosts in the form of host:port pairs
    • getSourceHostsListFromHostPortPairs

      public java.util.List<HostInfo> getSourceHostsListFromHostPortPairs​(java.util.Collection<java.lang.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 - a list of host:port pairs
      Returns:
      a list of HostInfo instances corresponding to the given host:port pairs
    • getReplicaHostOrSpawnIsolated

      public HostInfo getReplicaHostOrSpawnIsolated​(java.lang.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 - the host:port part to search for
      Returns:
      the existing host info or a new independent one
    • getReplicasListAsHostPortPairs

      public java.util.List<java.lang.String> getReplicasListAsHostPortPairs()
      Returns a list of this connection URL replica hosts in the form of host:port pairs.
      Returns:
      a list of this connection URL replica hosts in the form of host:port pairs
    • getReplicaHostsListFromHostPortPairs

      public java.util.List<HostInfo> getReplicaHostsListFromHostPortPairs​(java.util.Collection<java.lang.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 - a list of host:port pairs
      Returns:
      a list of HostInfo instances corresponding to the given host:port pairs