# Class AuroraProtocol

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.MastersReplicasProtocol
org.mariadb.jdbc.internal.protocol.AuroraProtocol

All Implemented Interfaces:
  `Closeable, AutoCloseable, Protocol`

public class AuroraProtocol extends MastersReplicasProtocol

## Field Summary

### Fields inherited from class MastersReplicasProtocol

`masterConnection`

### 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
`AuroraProtocol(UrlParser url, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`checkIfMaster()`
Aurora best way to check if a node is a master : is not in read-only mode.
`static AuroraProtocol`
`getNewProtocol(FailoverProxy proxy, GlobalStateInfo globalInfo, UrlParser urlParser)`
Initialize new protocol instance.
`boolean`
`isMasterConnection()`
Indicate if current protocol is a master protocol.
`boolean`
`isValid(int timeout)`
Check that connection is valid.
`static void`
`loop(AuroraListener listener, GlobalStateInfo globalInfo, List<HostAddress> addresses, SearchFilter initialSearchFilter)`
loop until found the failed connection.
`void`
`readPipelineCheckMaster()`

### Methods inherited from class MastersReplicasProtocol

`foundMaster, foundSecondary, loop, mustBeMasterConnection, setMustBeMasterConnection`

### Methods inherited from class MasterProtocol

`loop`

### 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, 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, 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, isServerMariaDb, noBackslashEscapes, prepareStatementCache, readEofPacket, 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, 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 Details

### AuroraProtocol

public AuroraProtocol(UrlParser url, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)

## Method Details

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

### getNewProtocol

public static AuroraProtocol getNewProtocol(FailoverProxy proxy, GlobalStateInfo globalInfo, UrlParser urlParser)
Initialize new protocol instance.

Parameters:
  `proxy` - proxy
  `globalInfo` - server global variables information
  `urlParser` - connection string data's
Returns:
  new AuroraProtocol

### isMasterConnection

public boolean isMasterConnection()
Description copied from class: `AbstractConnectProtocol`
Indicate if current protocol is a master protocol.

Specified by:
  `isMasterConnection` in interface `Protocol`
Overrides:
  `isMasterConnection` in class `AbstractConnectProtocol`
Returns:
  is master flag

### readPipelineCheckMaster

public void readPipelineCheckMaster() throws SQLException

Overrides:
  `readPipelineCheckMaster` in class `AbstractConnectProtocol`
Throws:
  `SQLException`

### isValid

public boolean isValid(int timeout) throws SQLException
Description copied from class: `AbstractQueryProtocol`
Check that connection is valid. !! careful, timeout is in milliseconds, connection.isValid(timeout) is in seconds !!

Specified by:
  `isValid` in interface `Protocol`
Overrides:
  `isValid` in class `AbstractQueryProtocol`
Parameters:
  `timeout` - timeout in milliseconds
Returns:
  true is valid
Throws:
  `SQLException` - if any error occur

### checkIfMaster

public boolean checkIfMaster() throws SQLException
Aurora best way to check if a node is a master : is not in read-only mode.

Specified by:
  `checkIfMaster` in interface `Protocol`
Overrides:
  `checkIfMaster` in class `AbstractConnectProtocol`
Returns:
  indicate if master has been found
Throws:
  `SQLException` - if requesting infos for server fail.