Package com.mysql.cj.jdbc.ha
Class LoadBalancedMySQLConnection
java.lang.Object
com.mysql.cj.jdbc.ha.MultiHostMySQLConnection
com.mysql.cj.jdbc.ha.LoadBalancedMySQLConnection
- All Implemented Interfaces:
LoadBalancedConnection,JdbcConnection,MysqlConnection,TransactionEventHandler,java.lang.AutoCloseable,java.sql.Connection,java.sql.Wrapper
public class LoadBalancedMySQLConnection extends MultiHostMySQLConnection implements LoadBalancedConnection
-
Field Summary
-
Constructor Summary
Constructors Constructor Description LoadBalancedMySQLConnection(LoadBalancedConnectionProxy proxy) -
Method Summary
Modifier and Type Method Description booleanaddHost(java.lang.String host)voidclose()LoadBalancedConnectionProxygetThisAsProxy()booleanisWrapperFor(java.lang.Class<?> iface)voidping()Detect if the connection is still good by sending a ping command to the server.voidping(boolean allConnections)voidremoveHost(java.lang.String host)voidremoveHostWhenNotInUse(java.lang.String host)<T> Tunwrap(java.lang.Class<T> iface)Methods inherited from class com.mysql.cj.jdbc.ha.MultiHostMySQLConnection
abort, abortInternal, changeUser, checkClosed, cleanup, clearHasTriedMaster, clearWarnings, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, commit, createArrayOf, createBlob, createClob, createNClob, createNewIO, createSQLXML, createStatement, createStatement, createStatement, createStruct, decachePreparedStatement, getActiveMySQLConnection, getActiveStatementCount, getAutoCommit, getAutoIncrementIncrement, getCachedMetaData, getCatalog, getCharacterSetMetadata, getClientInfo, getClientInfo, getClientInfoProviderImpl, getConnectionMutex, getDatabase, getExceptionInterceptor, getHoldability, getHost, getHostPortPair, getId, getIdleFor, getMetaData, getMetadataSafeStatement, getMultiHostParentProxy, getMultiHostSafeProxy, getNetworkTimeout, getProperties, getPropertySet, getQueryInterceptorsInstances, getSchema, getServerVersion, getSession, getSessionMaxRows, getStatementComment, getTransactionIsolation, getTypeMap, getURL, getUser, getWarnings, hasSameProperties, hasTriedMaster, initializeResultsMetadataFromCache, initializeSafeQueryInterceptors, isClosed, isInGlobalTx, isProxySet, isReadOnly, isReadOnly, isSameResource, isServerLocal, isSourceConnection, isValid, lowerCaseTableNames, nativeSQL, normalClose, pingInternal, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, realClose, recachePreparedStatement, registerStatement, releaseSavepoint, resetServerState, rollback, rollback, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setDatabase, setFailedOver, setHoldability, setInGlobalTx, setNetworkTimeout, setProxy, setReadOnly, setReadOnlyInternal, setSavepoint, setSavepoint, setSchema, setSessionMaxRows, setStatementComment, setTransactionIsolation, setTypeMap, shutdownServer, storesLowerCaseTableName, throwConnectionClosedException, transactionBegun, transactionCompleted, unregisterStatement, unSafeQueryInterceptorsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.sql.Connection
abort, beginRequest, clearWarnings, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, endRequest, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTransactionIsolation, setTypeMapMethods inherited from interface com.mysql.cj.jdbc.JdbcConnection
abortInternal, changeUser, clearHasTriedMaster, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, decachePreparedStatement, getActiveMySQLConnection, getActiveStatementCount, getAutoIncrementIncrement, getCachedMetaData, getCharacterSetMetadata, getClientInfoProviderImpl, getDatabase, getHost, getHostPortPair, getIdleFor, getMetadataSafeStatement, getMultiHostParentProxy, getMultiHostSafeProxy, getPropertySet, getQueryInterceptorsInstances, getServerVersion, getSessionMaxRows, getStatementComment, hasSameProperties, hasTriedMaster, initializeResultsMetadataFromCache, initializeSafeQueryInterceptors, isInGlobalTx, isMasterConnection, isProxySet, isReadOnly, isSameResource, isServerLocal, isSourceConnection, lowerCaseTableNames, pingInternal, realClose, recachePreparedStatement, registerStatement, resetServerState, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, setDatabase, setFailedOver, setInGlobalTx, setProxy, setReadOnlyInternal, setSessionMaxRows, setStatementComment, shutdownServer, storesLowerCaseTableName, throwConnectionClosedException, unregisterStatement, unSafeQueryInterceptorsMethods inherited from interface com.mysql.cj.MysqlConnection
checkClosed, cleanup, createNewIO, getConnectionMutex, getExceptionInterceptor, getId, getProperties, getSession, getURL, getUser, normalCloseMethods inherited from interface com.mysql.cj.TransactionEventHandler
transactionBegun, transactionCompleted
-
Constructor Details
-
Method Details
-
getThisAsProxy
- Overrides:
getThisAsProxyin classMultiHostMySQLConnection
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Connection- Overrides:
closein classMultiHostMySQLConnection- Throws:
java.sql.SQLException
-
ping
public void ping() throws java.sql.SQLExceptionDescription copied from interface:JdbcConnectionDetect if the connection is still good by sending a ping command to the server.- Specified by:
pingin interfaceJdbcConnection- Overrides:
pingin classMultiHostMySQLConnection- Throws:
java.sql.SQLException- if the ping fails
-
ping
public void ping(boolean allConnections) throws java.sql.SQLException- Specified by:
pingin interfaceLoadBalancedConnection- Throws:
java.sql.SQLException
-
addHost
public boolean addHost(java.lang.String host) throws java.sql.SQLException- Specified by:
addHostin interfaceLoadBalancedConnection- Throws:
java.sql.SQLException
-
removeHost
public void removeHost(java.lang.String host) throws java.sql.SQLException- Specified by:
removeHostin interfaceLoadBalancedConnection- Throws:
java.sql.SQLException
-
removeHostWhenNotInUse
public void removeHostWhenNotInUse(java.lang.String host) throws java.sql.SQLException- Specified by:
removeHostWhenNotInUsein interfaceLoadBalancedConnection- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Overrides:
isWrapperForin classMultiHostMySQLConnection- Throws:
java.sql.SQLException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Overrides:
unwrapin classMultiHostMySQLConnection- Throws:
java.sql.SQLException
-