# 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:
  `MastersReplicasProtocol`

public class MasterProtocol extends AbstractQueryProtocol implements Closeable

## Field Summary

### Fields inherited from class 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
`MasterProtocol(UrlParser urlParser, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)`
Get a protocol instance.

## Method Summary

Modifier and Type
Method
Description
`static void`
`loop(Listener listener, GlobalStateInfo globalInfo, List<HostAddress> addresses, SearchFilter searchFilter)`
loop until found the failed connection.

### Methods inherited from class 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, isValid, ping, prepare, prolog, prologProxy, putInCache, releasePrepareStatement, reset, resetDatabase, resetStateAfterFailover, rollback, setActiveFutureTask, setCatalog, setLocalInfileInputStream, setMaxRows, setReadonly, setTimeout, setTransactionIsolation, stopIfInterrupted`

### Methods inherited from class AbstractConnectProtocol

`abort, changeSocketSoTimeout, changeSocketTcpNoDelay, checkIfMaster, close, connect, connectWithoutProxy, destroySocket, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPatchServerVersion, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getSocketIp, getTimeZone, getTraces, getUrlParser, getUsername, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isMasterConnection, isServerMariaDb, mustBeMasterConnection, noBackslashEscapes, prepareStatementCache, readEofPacket, readPipelineCheckMaster, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual`

### Methods inherited from class Object

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

### Methods inherited from interface Closeable

`close`

### Methods inherited from interface Protocol

`abort, changeSocketSoTimeout, changeSocketTcpNoDelay, checkIfMaster, 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, isMasterConnection, isServerMariaDb, mustBeMasterConnection, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual`

## Constructor Details

### MasterProtocol

public MasterProtocol(UrlParser urlParser, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)
Get a protocol instance.

Parameters:
  `urlParser` - connection URL infos
  `globalInfo` - server global variables information
  `lock` - the lock for thread synchronisation
  `traceCache` - trace cache

## Method Details

### 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 failover
  `globalInfo` - server global variables information
  `addresses` - list of HostAddress to loop
  `searchFilter` - search parameter
Throws:
  `SQLException` - if not found