org.mariadb.jdbc.internal.mysql

## Class MastersSlavesProtocol

- java.lang.Object
- - org.mariadb.jdbc.internal.mysql.MySQLProtocol
  - - org.mariadb.jdbc.internal.mysql.MastersSlavesProtocol

All Implemented Interfaces:
  Protocol

Direct Known Subclasses:
  AuroraProtocol

    public class MastersSlavesProtocol
    extends MySQLProtocol

### Field Summary

### Fields inherited from class org.mariadb.jdbc.internal.mysql.MySQLProtocol

`activeResult, currentHost, datatypeMappingFlags, hasWarnings, jdbcUrl, lock, moreResults, packetFetcher, proxy, readOnly, serverStatus, socket, writer`

### Constructor Summary

Constructors
Constructor and Description
`MastersSlavesProtocol(JDBCUrl url, ReentrantReadWriteLock lock)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static MastersSlavesProtocol` `getNewProtocol(FailoverProxy proxy, JDBCUrl jdbcUrl)`
`static void` `loop(MastersSlavesListener listener, List<HostAddress> addresses, Map<HostAddress,Long> blacklist, SearchFilter searchFilter)` loop until found the failed connection.
`boolean` `mustBeMasterConnection()`
`void` `setMustBeMasterConnection(boolean mustBeMasterConnection)`

### Methods inherited from class org.mariadb.jdbc.internal.mysql.MySQLProtocol

`cancelCurrentQuery, checkIfMaster, close, close, closeExplicit, closeIfActiveResult, closePreparedStatement, connect, connectWithoutProxy, executeBatch, executePreparedQuery, executePreparedQueryAfterFailover, executeQuery, executeQuery, executeQuery, getAutocommit, getCalendar, getDatabase, getDatatypeMappingFlags, getHost, getHostAddress, getJdbcUrl, getMajorServerVersion, getMaxRows, getMinorServerVersion, getMoreResults, getOptions, getPassword, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReadonly, getResult, getServerData, getServerThreadId, getServerVersion, getTimeout, getTransactionIsolationLevel, getUsername, hasMoreResults, hasUnreadData, hasWarnings, hexdump, hexdump, inTransaction, isClosed, isConnected, isExplicitClosed, isMasterConnection, loop, noBackslashEscapes, ping, prepare, prepareStatementCache, releasePrepareStatement, rollback, setCatalog, setHostAddress, setHostFailedWithoutProxy, setInternalMaxRows, setLocalInfileInputStream, setMaxRows, setProxy, setReadonly, setTimeout, setTransactionIsolation, shouldReconnectWithoutProxy, versionGreaterOrEqual`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MastersSlavesProtocol

    public MastersSlavesProtocol(JDBCUrl url,
                                 ReentrantReadWriteLock lock)

### Method Detail

#### loop

    public static void loop(MastersSlavesListener listener,
                            List<HostAddress> addresses,
                            Map<HostAddress,Long> blacklist,
                            SearchFilter searchFilter)
                     throws QueryException

loop until found the failed connection.

Parameters:
  `listener` - current listener
  `addresses` - list of HostAddress to loop
  `blacklist` - current blacklist
  `searchFilter` - search parameter
Throws:
  `QueryException` - if not found

#### getNewProtocol

    public static MastersSlavesProtocol getNewProtocol(FailoverProxy proxy,
                                                       JDBCUrl jdbcUrl)

#### mustBeMasterConnection

    public boolean mustBeMasterConnection()

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

#### setMustBeMasterConnection

    public void setMustBeMasterConnection(boolean mustBeMasterConnection)