org.mariadb.jdbc.internal.protocol
Class AuroraProtocol

java.lang.Object
  extended by org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
      extended by org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol
          extended by org.mariadb.jdbc.internal.protocol.MasterProtocol
              extended by org.mariadb.jdbc.internal.protocol.MastersSlavesProtocol
                  extended by org.mariadb.jdbc.internal.protocol.AuroraProtocol
All Implemented Interfaces:
Closeable, Protocol

public class AuroraProtocol
extends MastersSlavesProtocol


Field Summary
 
Fields inherited from class org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol
readScheduler
 
Fields inherited from class org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
activeStreamingResult, autoIncrementIncrement, connected, currentHost, database, dataTypeMappingFlags, eofDeprecated, explicitClosed, hasWarnings, IS_MASTER_QUERY, lock, options, proxy, reader, readOnly, serverCapabilities, serverPrepareStatementCache, serverStatus, serverThreadId, SESSION_QUERY, socket, urlParser, writer
 
Constructor Summary
AuroraProtocol(UrlParser url, ReentrantLock lock)
           
 
Method Summary
 boolean checkIfMaster()
          Aurora best way to check if a node is a master : is not in read-only mode.
static AuroraProtocol getNewProtocol(FailoverProxy proxy, UrlParser urlParser)
          Initialize new protocol instance.
 boolean isMasterConnection()
          Indicate if current protocol is a master protocol.
 boolean isValid()
           
static void loop(AuroraListener listener, List<HostAddress> addresses, SearchFilter searchFilter)
          loop until found the failed connection.
 void readPipelineCheckMaster()
           
static void searchProbableMaster(AuroraListener listener, HostAddress probableMaster)
          Connect aurora probable master.
 
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, executeBatch, executeBatchMulti, executeBatchMultiple, executeBatchRewrite, executePreparedQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, forceReleasePrepareStatement, forceReleaseWaitingPrepareStatement, getAutocommit, getAutoIncrementIncrement, getMaxRows, getResult, getTimeout, getTransactionIsolationLevel, handleIoException, inTransaction, isInterrupted, ping, prepare, prepareAndExecute, prepareAndExecutes, prolog, prologProxy, readErrorPacket, readLocalInfilePacket, readOkPacket, readPacket, readResultSet, releasePrepareStatement, resetStateAfterFailover, rollback, setActiveFutureTask, setCatalog, setInternalMaxRows, setLocalInfileInputStream, setMaxRows, setTimeout, setTransactionIsolation, stopIfInterrupted
 
Methods inherited from class org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
changeSocketSoTimeout, changeSocketTcpNoDelay, close, close, connect, connectWithoutProxy, enabledSslCipherSuites, enabledSslProtocolSuites, getActiveStreamingResult, getDatabase, getDataTypeMappingFlags, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPassword, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerData, getServerThreadId, getServerVersion, getTimeZone, getTraces, getUrlParser, getUsername, getWriter, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isServerMariaDb, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sendPipelineCheckMaster, 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
changeSocketSoTimeout, changeSocketTcpNoDelay, close, connect, connectWithoutProxy, getActiveStreamingResult, getDatabase, getDataTypeMappingFlags, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPassword, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, 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,
                      ReentrantLock lock)
Method Detail

searchProbableMaster

public static void searchProbableMaster(AuroraListener listener,
                                        HostAddress probableMaster)
Connect aurora probable master. Aurora master change in time. The only way to check that a server is a master is to asked him.

Parameters:
listener - aurora failover to call back if master is found
probableMaster - probable master host

loop

public static void loop(AuroraListener listener,
                        List<HostAddress> addresses,
                        SearchFilter searchFilter)
                 throws SQLException
loop until found the failed connection.

Parameters:
listener - current failover
addresses - list of HostAddress to loop
searchFilter - search parameter
Throws:
SQLException - if not found

getNewProtocol

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

Parameters:
proxy - proxy
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 IOException,
                                    SQLException
Overrides:
readPipelineCheckMaster in class AbstractConnectProtocol
Throws:
IOException
SQLException

isValid

public boolean isValid()
                throws SQLException
Specified by:
isValid in interface Protocol
Overrides:
isValid in class AbstractQueryProtocol
Throws:
SQLException

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.


Copyright © 2017. All rights reserved.