Package com.mysql.cj.jdbc.ha
Interface ReplicationConnection
- All Superinterfaces:
java.lang.AutoCloseable,java.sql.Connection,JdbcConnection,MysqlConnection,TransactionEventHandler,java.sql.Wrapper
- All Known Implementing Classes:
ReplicationMySQLConnection
public interface ReplicationConnection extends JdbcConnection
-
Field Summary
-
Method Summary
Modifier and Type Method Description voidaddReplicaHost(java.lang.String host)default voidaddSlaveHost(java.lang.String host)Deprecated.longgetConnectionGroupId()JdbcConnectiongetCurrentConnection()default JdbcConnectiongetMasterConnection()Deprecated.JdbcConnectiongetReplicaConnection()default JdbcConnectiongetSlavesConnection()Deprecated.JdbcConnectiongetSourceConnection()default booleanisHostMaster(java.lang.String host)Deprecated.booleanisHostReplica(java.lang.String host)default booleanisHostSlave(java.lang.String host)Deprecated.booleanisHostSource(java.lang.String host)voidpromoteReplicaToSource(java.lang.String host)default voidpromoteSlaveToMaster(java.lang.String host)Deprecated.default voidremoveMasterHost(java.lang.String host)Deprecated.default voidremoveMasterHost(java.lang.String host, boolean waitUntilNotInUse)Deprecated.voidremoveReplica(java.lang.String host)voidremoveReplica(java.lang.String host, boolean closeGently)default voidremoveSlave(java.lang.String host)Deprecated.default voidremoveSlave(java.lang.String host, boolean closeGently)Deprecated.voidremoveSourceHost(java.lang.String host)voidremoveSourceHost(java.lang.String host, boolean waitUntilNotInUse)Methods inherited from interface java.sql.Connection
abort, beginRequest, clearWarnings, close, 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, ping, 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
-
Method Details
-
getConnectionGroupId
long getConnectionGroupId() -
getCurrentConnection
JdbcConnection getCurrentConnection() -
getSourceConnection
JdbcConnection getSourceConnection() -
getMasterConnection
Deprecated.UsegetSourceConnection()instead.- Returns:
JdbcConnection
-
promoteReplicaToSource
void promoteReplicaToSource(java.lang.String host) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
promoteSlaveToMaster
@Deprecated default void promoteSlaveToMaster(java.lang.String host) throws java.sql.SQLExceptionDeprecated.UsepromoteReplicaToSource(String)instead.- Parameters:
host- host name- Throws:
java.sql.SQLException
-
removeSourceHost
void removeSourceHost(java.lang.String host) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
removeMasterHost
@Deprecated default void removeMasterHost(java.lang.String host) throws java.sql.SQLExceptionDeprecated.UseremoveSourceHost(String)instead.- Parameters:
host- host name- Throws:
java.sql.SQLException
-
removeSourceHost
void removeSourceHost(java.lang.String host, boolean waitUntilNotInUse) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
removeMasterHost
@Deprecated default void removeMasterHost(java.lang.String host, boolean waitUntilNotInUse) throws java.sql.SQLExceptionDeprecated.UseremoveSourceHost(String, boolean)instead.- Parameters:
host- host namewaitUntilNotInUse- remove immediately or wait for it's release- Throws:
java.sql.SQLException
-
isHostSource
boolean isHostSource(java.lang.String host) -
isHostMaster
@Deprecated default boolean isHostMaster(java.lang.String host)Deprecated.UseisHostSource(String)instead.- Parameters:
host- host name- Returns:
- true if it's a source host
-
getReplicaConnection
JdbcConnection getReplicaConnection() -
getSlavesConnection
Deprecated.UsegetReplicaConnection()instead.- Returns:
JdbcConnection
-
addReplicaHost
void addReplicaHost(java.lang.String host) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
addSlaveHost
@Deprecated default void addSlaveHost(java.lang.String host) throws java.sql.SQLExceptionDeprecated.UseaddReplicaHost(String)instead.- Parameters:
host- host name- Throws:
java.sql.SQLException
-
removeReplica
void removeReplica(java.lang.String host) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
removeSlave
@Deprecated default void removeSlave(java.lang.String host) throws java.sql.SQLExceptionDeprecated.UseremoveReplica(String)instead.- Parameters:
host- host name- Throws:
java.sql.SQLException
-
removeReplica
void removeReplica(java.lang.String host, boolean closeGently) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
removeSlave
@Deprecated default void removeSlave(java.lang.String host, boolean closeGently) throws java.sql.SQLExceptionDeprecated.UseremoveReplica(String, boolean)instead.- Parameters:
host- host namecloseGently- mode- Throws:
java.sql.SQLException
-
isHostReplica
boolean isHostReplica(java.lang.String host) -
isHostSlave
@Deprecated default boolean isHostSlave(java.lang.String host)Deprecated.UseisHostReplica(String)instead.- Parameters:
host- host name- Returns:
- true if it's a replica
-