Top Fields Constructors Methods
com.mysql.cj.jdbc

public Class ConnectionGroup

extends Object
Class Inheritance
Imports
java.sql.SQLException, java.util.Collection, .HashMap, .HashSet, .List, .Map, .Set, java.util.concurrent.locks.Lock, .ReentrantLock, com.mysql.cj.Messages, com.mysql.cj.jdbc.exceptions.SQLError, com.mysql.cj.jdbc.ha.LoadBalancedConnectionProxy

Field Summary

Modifier and TypeField and Description
private long
private int
private Set<String>
private long
private long
private HashMap<Long, LoadBalancedConnectionProxy>
private Lock
private long
private String
private Set<String>
private boolean
private final Lock

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addHost(String
The host:port pair to add.
hostPortPair
)

Add the given host (host:port pair) to this Connection Group.

public void
addHost(String
The host:port pair to add.
hostPortPair
,
boolean
Whether affects existing load-balanced connections or only new ones.
forExisting
)

Add the given host (host:port pair) to this Connection Group and, consequently, to all the load-balanced connections it holds.

public void
public int
public long
public long
public Collection<String>
public String
public Collection<String>
public long
public long
public long
public long
public void
removeHost(String
The host:port pair to remove.
hostPortPair
)

Remove the given host (host:port pair) from this Connection Group.

public void
removeHost(String
The host:port pair to remove.
hostPortPair
,
boolean
Whether affects existing load-balanced connections or only new ones.
removeExisting
)

Remove the given host (host:port pair) from this Connection Group.

public void
removeHost(String
The host:port pair to remove.
hostPortPair
,
boolean
Whether affects existing load-balanced connections or only new ones.
removeExisting
,
boolean
If true instructs the load-balanced connections to fail-over the underlying active connection before removing this host, otherwise remove immediately.
waitForGracefulFailover
)

Remove the given host (host:port pair) from this Connection Group and, consequently, from all the load-balanced connections it holds.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activeConnectionsback to summary
private long activeConnections
activeHostsback to summary
private int activeHosts
closedHostsback to summary
private Set<String> closedHosts
closedProxyTotalPhysicalConnectionsback to summary
private long closedProxyTotalPhysicalConnections
closedProxyTotalTransactionsback to summary
private long closedProxyTotalTransactions
connectionProxiesback to summary
private HashMap<Long, LoadBalancedConnectionProxy> connectionProxies
connectionProxiesLockback to summary
private Lock connectionProxiesLock
connectionsback to summary
private long connections
groupNameback to summary
private String groupName
hostListback to summary
private Set<String> hostList
isInitializedback to summary
private boolean isInitialized
lockback to summary
private final Lock lock

Constructor Detail

ConnectionGroupback to summary
pack-priv ConnectionGroup(String groupName)

Method Detail

addHostback to summary
public void addHost(String hostPortPair)

Add the given host (host:port pair) to this Connection Group.

Parameters
hostPortPair:String

The host:port pair to add.

addHostback to summary
public void addHost(String hostPortPair, boolean forExisting)

Add the given host (host:port pair) to this Connection Group and, consequently, to all the load-balanced connections it holds.

Parameters
hostPortPair:String

The host:port pair to add.

forExisting:boolean

Whether affects existing load-balanced connections or only new ones.

closeConnectionProxyback to summary
public void closeConnectionProxy(LoadBalancedConnectionProxy proxy)
getActiveHostCountback to summary
public int getActiveHostCount()
getActiveLogicalConnectionCountback to summary
public long getActiveLogicalConnectionCount()
getActivePhysicalConnectionCountback to summary
public long getActivePhysicalConnectionCount()
getClosedHostsback to summary
public Collection<String> getClosedHosts()
getGroupNameback to summary
public String getGroupName()
getInitialHostsback to summary
public Collection<String> getInitialHosts()
getTotalLogicalConnectionCountback to summary
public long getTotalLogicalConnectionCount()
getTotalPhysicalConnectionCountback to summary
public long getTotalPhysicalConnectionCount()
getTotalTransactionCountback to summary
public long getTotalTransactionCount()
registerConnectionProxyback to summary
public long registerConnectionProxy(LoadBalancedConnectionProxy proxy, List<String> localHostList)
removeHostback to summary
public void removeHost(String hostPortPair) throws SQLException

Remove the given host (host:port pair) from this Connection Group.

Parameters
hostPortPair:String

The host:port pair to remove.

Exceptions
SQLException:
if a database access error occurs
removeHostback to summary
public void removeHost(String hostPortPair, boolean removeExisting) throws SQLException

Remove the given host (host:port pair) from this Connection Group.

Parameters
hostPortPair:String

The host:port pair to remove.

removeExisting:boolean

Whether affects existing load-balanced connections or only new ones.

Exceptions
SQLException:
if a database access error occurs
removeHostback to summary
public void removeHost(String hostPortPair, boolean removeExisting, boolean waitForGracefulFailover) throws SQLException

Remove the given host (host:port pair) from this Connection Group and, consequently, from all the load-balanced connections it holds.

Parameters
hostPortPair:String

The host:port pair to remove.

removeExisting:boolean

Whether affects existing load-balanced connections or only new ones.

waitForGracefulFailover:boolean

If true instructs the load-balanced connections to fail-over the underlying active connection before removing this host, otherwise remove immediately.

Exceptions
SQLException:
if a database access error occurs