Class AuroraProtocol
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Protocol
public class AuroraProtocol extends MastersReplicasProtocol
-
-
Field Summary
-
Fields inherited from class org.mariadb.jdbc.internal.protocol.MastersReplicasProtocol
masterConnection
-
Fields inherited from class org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
activeStreamingResult, autoIncrementIncrement, CHECK_GALERA_STATE_QUERY, connected, database, eofDeprecated, exceptionFactory, explicitClosed, galeraAllowedStates, hasWarnings, lock, options, proxy, reader, readOnly, serverCapabilities, serverPrepareStatementCache, serverStatus, serverThreadId, socket, socketTimeout, traceCache, urlParser, writer
-
-
Constructor Summary
Constructors Constructor Description AuroraProtocol(UrlParser url, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckIfMaster()Aurora best way to check if a node is a master : is not in read-only mode.static AuroraProtocolgetNewProtocol(FailoverProxy proxy, GlobalStateInfo globalInfo, UrlParser urlParser)Initialize new protocol instance.booleanisMasterConnection()Indicate if current protocol is a master protocol.booleanisValid(int timeout)Check that connection is valid.static voidloop(AuroraListener listener, GlobalStateInfo globalInfo, List<HostAddress> addresses, SearchFilter initialSearchFilter)loop until found the failed connection.voidreadPipelineCheckMaster()-
Methods inherited from class org.mariadb.jdbc.internal.protocol.MastersReplicasProtocol
foundMaster, foundSecondary, loop, mustBeMasterConnection, setMustBeMasterConnection
-
Methods inherited from class org.mariadb.jdbc.internal.protocol.MasterProtocol
loop
-
Methods inherited from class org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol
cancelCurrentQuery, closeExplicit, executeBatchClient, executeBatchServer, executeBatchStmt, executePreparedQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, forceReleasePrepareStatement, forceReleaseWaitingPrepareStatement, getAutocommit, getAutoIncrementIncrement, getCatalog, getMaxRows, getResult, getTimeout, getTransactionIsolationLevel, handleIoException, interrupt, inTransaction, isInterrupted, ping, prepare, prolog, prologProxy, putInCache, releasePrepareStatement, reset, resetDatabase, resetStateAfterFailover, rollback, setActiveFutureTask, setCatalog, setLocalInfileInputStream, setMaxRows, setReadonly, setTimeout, setTransactionIsolation, stopIfInterrupted
-
Methods inherited from class org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
abort, changeSocketSoTimeout, changeSocketTcpNoDelay, close, connect, connectWithoutProxy, destroySocket, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPatchServerVersion, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getTimeZone, getTraces, getUrlParser, getUsername, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isServerMariaDb, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mariadb.jdbc.internal.protocol.Protocol
abort, changeSocketSoTimeout, changeSocketTcpNoDelay, close, connect, connectWithoutProxy, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPatchServerVersion, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getTimeZone, getTraces, getUrlParser, getUsername, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isServerMariaDb, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual
-
-
-
-
Constructor Detail
-
AuroraProtocol
public AuroraProtocol(UrlParser url, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)
-
-
Method Detail
-
loop
public static void loop(AuroraListener listener, GlobalStateInfo globalInfo, List<HostAddress> addresses, SearchFilter initialSearchFilter) throws SQLException
loop until found the failed connection.- Parameters:
listener- current failoverglobalInfo- server global variables informationaddresses- list of HostAddress to loopinitialSearchFilter- search parameter- Throws:
SQLException- if not found
-
getNewProtocol
public static AuroraProtocol getNewProtocol(FailoverProxy proxy, GlobalStateInfo globalInfo, UrlParser urlParser)
Initialize new protocol instance.- Parameters:
proxy- proxyglobalInfo- server global variables informationurlParser- connection string data's- Returns:
- new AuroraProtocol
-
isMasterConnection
public boolean isMasterConnection()
Description copied from class:AbstractConnectProtocolIndicate if current protocol is a master protocol.- Specified by:
isMasterConnectionin interfaceProtocol- Overrides:
isMasterConnectionin classAbstractConnectProtocol- Returns:
- is master flag
-
readPipelineCheckMaster
public void readPipelineCheckMaster() throws SQLException- Overrides:
readPipelineCheckMasterin classAbstractConnectProtocol- Throws:
SQLException
-
isValid
public boolean isValid(int timeout) throws SQLExceptionDescription copied from class:AbstractQueryProtocolCheck that connection is valid. !! careful, timeout is in milliseconds, connection.isValid(timeout) is in seconds !!- Specified by:
isValidin interfaceProtocol- Overrides:
isValidin classAbstractQueryProtocol- Parameters:
timeout- timeout in milliseconds- Returns:
- true is valid
- Throws:
SQLException- if any error occur
-
checkIfMaster
public boolean checkIfMaster() throws SQLExceptionAurora best way to check if a node is a master : is not in read-only mode.- Specified by:
checkIfMasterin interfaceProtocol- Overrides:
checkIfMasterin classAbstractConnectProtocol- Returns:
- indicate if master has been found
- Throws:
SQLException- if requesting infos for server fail.
-
-