org.mariadb.jdbc.internal.failover
Class AbstractMastersSlavesListener

java.lang.Object
  extended by org.mariadb.jdbc.internal.failover.AbstractMastersListener
      extended by org.mariadb.jdbc.internal.failover.AbstractMastersSlavesListener
All Implemented Interfaces:
Listener
Direct Known Subclasses:
MastersSlavesListener

public abstract class AbstractMastersSlavesListener
extends AbstractMastersListener


Field Summary
protected  AtomicReference<Protocol> waitNewMasterProtocol
           
protected  AtomicReference<Protocol> waitNewSecondaryProtocol
           
 
Fields inherited from class org.mariadb.jdbc.internal.failover.AbstractMastersListener
currentConnectionAttempts, currentProtocol, currentReadOnlyAsked, explicitClosed, lastQueryNanos, lastRetry, proxy, urlParser
 
Constructor Summary
protected AbstractMastersSlavesListener(UrlParser urlParser)
           
 
Method Summary
abstract  void foundActiveSecondary(Protocol newSecondaryProtocol)
           
 SearchFilter getFilterForFailedHost()
           
 long getSecondaryHostFailNanos()
           
 HandleErrorResult handleFailover(SQLException qe, Method method, Object[] args, Protocol protocol)
          Handle failover on master or slave connection.
 boolean hasHostFail()
           
 boolean isMasterHostFailReconnect()
           
 boolean isSecondaryHostFail()
           
 boolean isSecondaryHostFailReconnect()
           
protected  void resetMasterFailoverData()
           
protected  void resetSecondaryFailoverData()
           
abstract  HandleErrorResult secondaryFail(Method method, Object[] args)
           
 boolean setSecondaryHostFail()
          Set slave connection lost variables.
 
Methods inherited from class org.mariadb.jdbc.internal.failover.AbstractMastersListener
addToBlacklist, canRetryFailLoop, checkMasterStatus, clearBlacklist, closeConnection, getBlacklistKeys, getCurrentProtocol, getLastQueryNanos, getMasterHostFailNanos, getProxy, getRetriesAllDown, getUrlParser, handleFailLoop, initializeConnection, invoke, invoke, isAutoReconnect, isClosed, isExplicitClosed, isMasterHostFail, isQueryRelaunchable, isReadOnly, pingMasterProtocol, preAutoReconnect, preClose, preExecute, primaryFail, reconnect, reconnectFailedConnection, relaunchOperation, removeFromBlacklist, removeListenerFromSchedulers, resetOldsBlackListHosts, setMasterHostFail, setProxy, setSessionReadOnly, switchReadOnlyConnection, syncConnection, throwFailoverMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mariadb.jdbc.internal.failover.Listener
foundActiveMaster, isMasterConnected, rePrepareOnSlave
 

Field Detail

waitNewSecondaryProtocol

protected AtomicReference<Protocol> waitNewSecondaryProtocol

waitNewMasterProtocol

protected AtomicReference<Protocol> waitNewMasterProtocol
Constructor Detail

AbstractMastersSlavesListener

protected AbstractMastersSlavesListener(UrlParser urlParser)
Method Detail

handleFailover

public HandleErrorResult handleFailover(SQLException qe,
                                        Method method,
                                        Object[] args,
                                        Protocol protocol)
                                 throws Throwable
Handle failover on master or slave connection.

Specified by:
handleFailover in interface Listener
Overrides:
handleFailover in class AbstractMastersListener
Parameters:
method - called method
args - methods parameters
protocol - current protocol
Returns:
HandleErrorResult object to indicate if query has finally been relaunched or exception if not.
Throws:
Throwable - if method with parameters doesn't exist

resetMasterFailoverData

protected void resetMasterFailoverData()
Overrides:
resetMasterFailoverData in class AbstractMastersListener

resetSecondaryFailoverData

protected void resetSecondaryFailoverData()

getSecondaryHostFailNanos

public long getSecondaryHostFailNanos()

setSecondaryHostFail

public boolean setSecondaryHostFail()
Set slave connection lost variables.

Returns:
true if fail wasn't seen before

isSecondaryHostFail

public boolean isSecondaryHostFail()

isSecondaryHostFailReconnect

public boolean isSecondaryHostFailReconnect()

isMasterHostFailReconnect

public boolean isMasterHostFailReconnect()

hasHostFail

public boolean hasHostFail()
Specified by:
hasHostFail in interface Listener
Overrides:
hasHostFail in class AbstractMastersListener

getFilterForFailedHost

public SearchFilter getFilterForFailedHost()
Specified by:
getFilterForFailedHost in interface Listener
Overrides:
getFilterForFailedHost in class AbstractMastersListener

secondaryFail

public abstract HandleErrorResult secondaryFail(Method method,
                                                Object[] args)
                                         throws Throwable
Throws:
Throwable

foundActiveSecondary

public abstract void foundActiveSecondary(Protocol newSecondaryProtocol)
                                   throws SQLException
Throws:
SQLException


Copyright © 2017. All rights reserved.