org.mariadb.jdbc.internal.protocol

## Class MastersSlavesProtocol

- java.lang.Object
- - org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
  - - org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol
    - - org.mariadb.jdbc.internal.protocol.MasterProtocol
      - - org.mariadb.jdbc.internal.protocol.MastersSlavesProtocol

All Implemented Interfaces:
  Closeable, AutoCloseable, Protocol

Direct Known Subclasses:
  AuroraProtocol

    public class MastersSlavesProtocol
    extends MasterProtocol

### Field Summary

Fields
`protected boolean` `masterConnection`

### Fields inherited from class org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol

`readScheduler`

### Fields 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, urlParser, writer`

### Constructor Summary

Constructors
Constructor and Description
`MastersSlavesProtocol(UrlParser url, GlobalStateInfo globalInfo, ReentrantLock lock)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected static boolean` `foundMaster(MastersSlavesListener listener, MastersSlavesProtocol protocol, SearchFilter searchFilter)`
`protected static boolean` `foundSecondary(MastersSlavesListener listener, MastersSlavesProtocol protocol, SearchFilter searchFilter)`
`static void` `loop(MastersSlavesListener listener, GlobalStateInfo globalInfo, List<HostAddress> addresses, SearchFilter searchFilter)` loop until found the failed connection.
`boolean` `mustBeMasterConnection()`
`void` `setMustBeMasterConnection(boolean mustBeMasterConnection)`

### Methods inherited from class org.mariadb.jdbc.internal.protocol.MasterProtocol

`loop`

### 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, stopIfInterrupted`

### Methods 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, noBackslashEscapes, prepareStatementCache, readEofPacket, readPipelineCheckMaster, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setReadonly, 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 java.io.Closeable

`close`

### Methods 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, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setReadonly, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual`

### Field Detail

#### masterConnection

    protected boolean masterConnection

### Constructor Detail

#### MastersSlavesProtocol

    public MastersSlavesProtocol(UrlParser url,
                                 GlobalStateInfo globalInfo,
                                 ReentrantLock lock)

### Method Detail

#### loop

    public static void loop(MastersSlavesListener listener,
                            GlobalStateInfo globalInfo,
                            List<HostAddress> addresses,
                            SearchFilter searchFilter)
                     throws SQLException

loop until found the failed connection.

Parameters:
  `listener` - current failover
  `globalInfo` - server global variables information
  `addresses` - list of HostAddress to loop
  `searchFilter` - search parameter
Throws:
  `SQLException` - if not found

#### foundMaster

    protected static boolean foundMaster(MastersSlavesListener listener,
                                         MastersSlavesProtocol protocol,
                                         SearchFilter searchFilter)

#### foundSecondary

    protected static boolean foundSecondary(MastersSlavesListener listener,
                                            MastersSlavesProtocol protocol,
                                            SearchFilter searchFilter)
                                     throws SQLException

Throws:
  `SQLException`

#### mustBeMasterConnection

    public boolean mustBeMasterConnection()

Specified by:
  `mustBeMasterConnection` in interface `Protocol`
Overrides:
  `mustBeMasterConnection` in class `AbstractConnectProtocol`

#### setMustBeMasterConnection

    public void setMustBeMasterConnection(boolean mustBeMasterConnection)