org.mariadb.jdbc.internal.protocol

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

All Implemented Interfaces:
  Closeable, AutoCloseable, Protocol

    public class AuroraProtocol
    extends MastersSlavesProtocol

### Field Summary

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

`masterConnection`

### Fields inherited from class org.mariadb.jdbc.internal.protocol.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 and Description
`AuroraProtocol(UrlParser url, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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 org.mariadb.jdbc.internal.protocol.MastersSlavesProtocol

`foundMaster, foundSecondary, loop, mustBeMasterConnection, setMustBeMasterConnection`

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

### Constructor Detail

#### AuroraProtocol

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

### Method Detail

#### 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.