org.mariadb.jdbc.internal.protocol
Class MastersSlavesProtocol

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
All Implemented Interfaces:
Closeable, Protocol
Direct Known Subclasses:
AuroraProtocol

public class MastersSlavesProtocol
extends MasterProtocol


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
MastersSlavesProtocol(UrlParser url, ReentrantLock lock)
           
 
Method Summary
protected static boolean foundMaster(MastersSlavesListener listener, MastersSlavesProtocol protocol, SearchFilter searchFilter)
           
protected static boolean foundSecondary(MastersSlavesListener listener, MastersSlavesProtocol protocol, SearchFilter searchFilter)
           
static MastersSlavesProtocol getNewProtocol(FailoverProxy proxy, UrlParser urlParser)
          Get new instance of MastersSlavesProtocol.
static void loop(MastersSlavesListener listener, List<HostAddress> addresses, SearchFilter searchFilter)
          loop until found the failed connection.
 boolean mustBeMasterConnection()
           
 void setMustBeMasterConnection(boolean mustBeMasterConnection)
           
 
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, isValid, 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, checkIfMaster, 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, isMasterConnection, isServerMariaDb, noBackslashEscapes, prepareStatementCache, readEofPacket, readPipelineCheckMaster, 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, checkIfMaster, 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, isMasterConnection, isServerMariaDb, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setReadonly, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual
 

Constructor Detail

MastersSlavesProtocol

public MastersSlavesProtocol(UrlParser url,
                             ReentrantLock lock)
Method Detail

loop

public static void loop(MastersSlavesListener 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

foundMaster

protected static boolean foundMaster(MastersSlavesListener listener,
                                     MastersSlavesProtocol protocol,
                                     SearchFilter searchFilter)

foundSecondary

protected static boolean foundSecondary(MastersSlavesListener listener,
                                        MastersSlavesProtocol protocol,
                                        SearchFilter searchFilter)
                                 throws SQLException
Throws:
SQLException

getNewProtocol

public static MastersSlavesProtocol getNewProtocol(FailoverProxy proxy,
                                                   UrlParser urlParser)
Get new instance of MastersSlavesProtocol.

Parameters:
proxy - proxy
urlParser - connection string Object.
Returns:
a new MastersSlavesProtocol instance

mustBeMasterConnection

public boolean mustBeMasterConnection()
Specified by:
mustBeMasterConnection in interface Protocol
Overrides:
mustBeMasterConnection in class AbstractConnectProtocol

setMustBeMasterConnection

public void setMustBeMasterConnection(boolean mustBeMasterConnection)


Copyright © 2017. All rights reserved.