public class ReplicationMySQLConnection extends MultiHostMySQLConnection implements ReplicationConnection
thisAsProxy
Constructor and Description |
---|
ReplicationMySQLConnection(MultiHostConnectionProxy proxy) |
Modifier and Type | Method and Description |
---|---|
void |
abort(java.util.concurrent.Executor executor) |
void |
abortInternal()
Clobbers the physical network connection and marks this connection as closed.
|
void |
addSlaveHost(java.lang.String host) |
void |
changeUser(java.lang.String userName,
java.lang.String newPassword)
Changes the user on this connection by performing a re-authentication.
|
void |
clearHasTriedMaster()
Deprecated.
|
JdbcConnection |
getActiveMySQLConnection() |
long |
getConnectionGroupId() |
JdbcConnection |
getCurrentConnection() |
JdbcConnection |
getMasterConnection() |
java.util.Properties |
getProperties()
Returns the parsed and passed in properties for this connection.
|
JdbcConnection |
getSlavesConnection() |
ReplicationConnectionProxy |
getThisAsProxy() |
boolean |
hasSameProperties(JdbcConnection c)
Does this connection have the same properties as another?
|
boolean |
isHostMaster(java.lang.String host) |
boolean |
isHostSlave(java.lang.String host) |
boolean |
isReadOnly() |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
ping()
Detect if the connection is still good by sending a ping command
to the server.
|
void |
promoteSlaveToMaster(java.lang.String host) |
void |
removeMasterHost(java.lang.String host) |
void |
removeMasterHost(java.lang.String host,
boolean waitUntilNotInUse) |
void |
removeSlave(java.lang.String host) |
void |
removeSlave(java.lang.String host,
boolean closeGently) |
void |
setProxy(JdbcConnection proxy) |
void |
setReadOnly(boolean readOnlyFlag) |
void |
setStatementComment(java.lang.String comment)
Sets the comment that will be prepended to all statements
sent to the server.
|
<T> T |
unwrap(java.lang.Class<T> iface) |
checkClosed, cleanup, clearWarnings, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, close, commit, createArrayOf, createBlob, createClob, createNClob, createNewIO, createSQLXML, createStatement, createStatement, createStatement, createStruct, decachePreparedStatement, getActiveStatementCount, getAutoCommit, getAutoIncrementIncrement, getCachedMetaData, getCatalog, getCharacterSetMetadata, getClientInfo, getClientInfo, getClientInfoProviderImpl, getConnectionMutex, getDatabase, getExceptionInterceptor, getHoldability, getHost, getHostPortPair, getId, getIdleFor, getMetaData, getMetadataSafeStatement, getMultiHostParentProxy, getMultiHostSafeProxy, getNetworkTimeout, getPropertySet, getQueryInterceptorsInstances, getSchema, getServerVersion, getSession, getSessionMaxRows, getStatementComment, getTransactionIsolation, getTypeMap, getURL, getUser, getWarnings, hasTriedMaster, initializeResultsMetadataFromCache, initializeSafeQueryInterceptors, isClosed, isInGlobalTx, isMasterConnection, isProxySet, isReadOnly, isSameResource, isServerLocal, 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, setReadOnlyInternal, setSavepoint, setSavepoint, setSchema, setSessionMaxRows, setTransactionIsolation, setTypeMap, shutdownServer, storesLowerCaseTableName, throwConnectionClosedException, transactionBegun, transactionCompleted, unregisterStatement, unSafeQueryInterceptors
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, clientPrepareStatement, decachePreparedStatement, getActiveStatementCount, getAutoIncrementIncrement, getCachedMetaData, getCharacterSetMetadata, getClientInfoProviderImpl, getDatabase, getHost, getHostPortPair, getIdleFor, getMetadataSafeStatement, getMultiHostParentProxy, getMultiHostSafeProxy, getPropertySet, getQueryInterceptorsInstances, getServerVersion, getSessionMaxRows, getStatementComment, hasTriedMaster, initializeResultsMetadataFromCache, initializeSafeQueryInterceptors, isInGlobalTx, isMasterConnection, isProxySet, isReadOnly, isSameResource, isServerLocal, lowerCaseTableNames, pingInternal, realClose, recachePreparedStatement, registerStatement, resetServerState, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, serverPrepareStatement, setDatabase, setFailedOver, setInGlobalTx, setReadOnlyInternal, setSessionMaxRows, shutdownServer, storesLowerCaseTableName, throwConnectionClosedException, unregisterStatement, unSafeQueryInterceptors
clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap
checkClosed, cleanup, createNewIO, getConnectionMutex, getExceptionInterceptor, getId, getSession, getURL, getUser, normalClose
transactionBegun, transactionCompleted
public ReplicationMySQLConnection(MultiHostConnectionProxy proxy)
public ReplicationConnectionProxy getThisAsProxy()
getThisAsProxy
in class MultiHostMySQLConnection
public JdbcConnection getActiveMySQLConnection()
getActiveMySQLConnection
in interface JdbcConnection
getActiveMySQLConnection
in class MultiHostMySQLConnection
public JdbcConnection getCurrentConnection()
getCurrentConnection
in interface ReplicationConnection
public long getConnectionGroupId()
getConnectionGroupId
in interface ReplicationConnection
public JdbcConnection getMasterConnection()
getMasterConnection
in interface ReplicationConnection
public void promoteSlaveToMaster(java.lang.String host) throws java.sql.SQLException
promoteSlaveToMaster
in interface ReplicationConnection
java.sql.SQLException
public void removeMasterHost(java.lang.String host) throws java.sql.SQLException
removeMasterHost
in interface ReplicationConnection
java.sql.SQLException
public void removeMasterHost(java.lang.String host, boolean waitUntilNotInUse) throws java.sql.SQLException
removeMasterHost
in interface ReplicationConnection
java.sql.SQLException
public boolean isHostMaster(java.lang.String host)
isHostMaster
in interface ReplicationConnection
public JdbcConnection getSlavesConnection()
getSlavesConnection
in interface ReplicationConnection
public void addSlaveHost(java.lang.String host) throws java.sql.SQLException
addSlaveHost
in interface ReplicationConnection
java.sql.SQLException
public void removeSlave(java.lang.String host) throws java.sql.SQLException
removeSlave
in interface ReplicationConnection
java.sql.SQLException
public void removeSlave(java.lang.String host, boolean closeGently) throws java.sql.SQLException
removeSlave
in interface ReplicationConnection
java.sql.SQLException
public boolean isHostSlave(java.lang.String host)
isHostSlave
in interface ReplicationConnection
public void setReadOnly(boolean readOnlyFlag) throws java.sql.SQLException
setReadOnly
in interface java.sql.Connection
setReadOnly
in class MultiHostMySQLConnection
java.sql.SQLException
public boolean isReadOnly() throws java.sql.SQLException
isReadOnly
in interface java.sql.Connection
isReadOnly
in class MultiHostMySQLConnection
java.sql.SQLException
public void ping() throws java.sql.SQLException
JdbcConnection
ping
in interface JdbcConnection
ping
in class MultiHostMySQLConnection
java.sql.SQLException
- if the ping failspublic void changeUser(java.lang.String userName, java.lang.String newPassword) throws java.sql.SQLException
JdbcConnection
changeUser
in interface JdbcConnection
changeUser
in class MultiHostMySQLConnection
userName
- the username to authenticate withnewPassword
- the password to authenticate withjava.sql.SQLException
- if authentication fails, or some other error occurs while
performing the command.public void setStatementComment(java.lang.String comment)
JdbcConnection
setStatementComment
in interface JdbcConnection
setStatementComment
in class MultiHostMySQLConnection
comment
- the comment that will be prepended to all statements
sent to the server.public boolean hasSameProperties(JdbcConnection c)
JdbcConnection
hasSameProperties
in interface JdbcConnection
hasSameProperties
in class MultiHostMySQLConnection
c
- connectionpublic java.util.Properties getProperties()
MysqlConnection
getProperties
in interface MysqlConnection
getProperties
in class MultiHostMySQLConnection
Properties
public void abort(java.util.concurrent.Executor executor) throws java.sql.SQLException
abort
in interface java.sql.Connection
abort
in class MultiHostMySQLConnection
java.sql.SQLException
public void abortInternal() throws java.sql.SQLException
JdbcConnection
abortInternal
in interface JdbcConnection
abortInternal
in class MultiHostMySQLConnection
java.sql.SQLException
- if an error occurspublic void setProxy(JdbcConnection proxy)
setProxy
in interface JdbcConnection
setProxy
in class MultiHostMySQLConnection
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
isWrapperFor
in class MultiHostMySQLConnection
java.sql.SQLException
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
unwrap
in class MultiHostMySQLConnection
java.sql.SQLException
@Deprecated public void clearHasTriedMaster()
clearHasTriedMaster
in interface JdbcConnection
clearHasTriedMaster
in class MultiHostMySQLConnection