Class MasterProtocol
java.lang.Object
org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol
org.mariadb.jdbc.internal.protocol.MasterProtocol
- All Implemented Interfaces:
Closeable,AutoCloseable,Protocol
- Direct Known Subclasses:
MastersSlavesProtocol
-
Field Summary
Fields inherited from class org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol
readSchedulerFields inherited from class org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
activeStreamingResult, autoIncrementIncrement, connected, database, eofDeprecated, explicitClosed, hasWarnings, lock, options, proxy, reader, readOnly, serverCapabilities, serverPrepareStatementCache, serverStatus, serverThreadId, socket, socketTimeout, urlParser, writer -
Constructor Summary
ConstructorsConstructorDescriptionMasterProtocol(UrlParser urlParser, GlobalStateInfo globalInfo, ReentrantLock lock) Get a protocol instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate static MasterProtocolgetNewProtocol(FailoverProxy proxy, GlobalStateInfo globalInfo, UrlParser urlParser) Get new instance.static voidloop(Listener listener, GlobalStateInfo globalInfo, List<HostAddress> addresses, SearchFilter searchFilter) loop until found the failed connection.private static voidresetHostList(Listener listener, Deque<HostAddress> loopAddresses) Reinitialize loopAddresses with all hosts : all servers in randomize order without connected host.Methods inherited from class org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol
addPrepareInCache, cancelCurrentQuery, closeExplicit, executeBatchClient, executeBatchServer, executeBatchStmt, executePreparedQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, forceReleasePrepareStatement, forceReleaseWaitingPrepareStatement, getAutocommit, getAutoIncrementIncrement, getCatalog, getMaxRows, getResult, getTimeout, getTransactionIsolationLevel, handleIoException, interrupt, inTransaction, isInterrupted, isValid, ping, prepare, prolog, prologProxy, releasePrepareStatement, reset, resetDatabase, resetStateAfterFailover, rollback, setActiveFutureTask, setCatalog, setLocalInfileInputStream, setMaxRows, setTimeout, setTransactionIsolation, stopIfInterruptedMethods inherited from class org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
abort, changeSocketSoTimeout, changeSocketTcpNoDelay, checkIfMaster, close, connect, connectWithoutProxy, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getTimeZone, getTraces, getUrlParser, getUsername, getWriter, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isMasterConnection, isServerMariaDb, mustBeMasterConnection, noBackslashEscapes, prepareStatementCache, readEofPacket, readPipelineCheckMaster, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setReadonly, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqualMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.mariadb.jdbc.internal.protocol.Protocol
abort, changeSocketSoTimeout, changeSocketTcpNoDelay, checkIfMaster, close, connect, connectWithoutProxy, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getTimeZone, getTraces, getUrlParser, getUsername, getWriter, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isMasterConnection, isServerMariaDb, mustBeMasterConnection, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setReadonly, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual
-
Constructor Details
-
MasterProtocol
Get a protocol instance.- Parameters:
urlParser- connection URL infosglobalInfo- server global variables informationlock- the lock for thread synchronisation
-
-
Method Details
-
getNewProtocol
private static MasterProtocol getNewProtocol(FailoverProxy proxy, GlobalStateInfo globalInfo, UrlParser urlParser) Get new instance.- Parameters:
proxy- proxyurlParser- url connection object- Returns:
- new instance
-
loop
public static void loop(Listener listener, GlobalStateInfo globalInfo, List<HostAddress> addresses, SearchFilter searchFilter) throws SQLException loop until found the failed connection.- Parameters:
listener- current failoverglobalInfo- server global variables informationaddresses- list of HostAddress to loopsearchFilter- search parameter- Throws:
SQLException- if not found
-
resetHostList
Reinitialize loopAddresses with all hosts : all servers in randomize order without connected host.- Parameters:
listener- current listenerloopAddresses- the list to reinitialize
-