Class AbstractMastersSlavesListener
java.lang.Object
org.mariadb.jdbc.internal.failover.AbstractMastersListener
org.mariadb.jdbc.internal.failover.AbstractMastersSlavesListener
- All Implemented Interfaces:
Listener
- Direct Known Subclasses:
MastersSlavesListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Loggerprivate final AtomicBooleanprivate longprotected final AtomicReference<Protocol> protected final AtomicReference<Protocol> Fields inherited from class org.mariadb.jdbc.internal.failover.AbstractMastersListener
currentConnectionAttempts, currentProtocol, currentReadOnlyAsked, explicitClosed, globalInfo, lastQueryNanos, lastRetry, proxy, urlParser -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMastersSlavesListener(UrlParser urlParser, GlobalStateInfo globalInfo) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidfoundActiveSecondary(Protocol newSecondaryProtocol) longhandleFailover(SQLException qe, Method method, Object[] args, Protocol protocol, boolean isClosed) Handle failover on master or slave connection.booleanbooleanbooleanbooleanprotected voidprotected voidabstract HandleErrorResultsecondaryFail(Method method, Object[] args, boolean killCmd) booleanSet slave connection lost variables.Methods inherited from class org.mariadb.jdbc.internal.failover.AbstractMastersListener
abortConnection, addToBlacklist, canRetryFailLoop, checkMasterStatus, clearBlacklist, closeConnection, getBlacklistKeys, getCatalog, getCurrentProtocol, getLastQueryNanos, getMajorServerVersion, getMasterHostFailNanos, getProxy, getRetriesAllDown, getTimeout, getUrlParser, handleFailLoop, initializeConnection, inTransaction, invoke, invoke, isAutoReconnect, isClosed, isExplicitClosed, isMasterConnection, isMasterHostFail, isQueryRelaunchable, isReadOnly, isServerMariaDb, isValid, noBackslashEscapes, pingMasterProtocol, preAutoReconnect, preClose, preExecute, primaryFail, prolog, reconnect, reconnectFailedConnection, relaunchOperation, removeFromBlacklist, removeListenerFromSchedulers, resetOldsBlackListHosts, sessionStateAware, setMasterHostFail, setProxy, setSessionReadOnly, switchReadOnlyConnection, syncConnection, throwFailoverMessage, versionGreaterOrEqualMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.mariadb.jdbc.internal.failover.Listener
foundActiveMaster, getServerThreadId, isMasterConnected, preAbort, rePrepareOnSlave, reset
-
Field Details
-
logger
-
waitNewSecondaryProtocol
-
waitNewMasterProtocol
-
secondaryHostFail
-
secondaryHostFailNanos
private volatile long secondaryHostFailNanos
-
-
Constructor Details
-
AbstractMastersSlavesListener
-
-
Method Details
-
handleFailover
public HandleErrorResult handleFailover(SQLException qe, Method method, Object[] args, Protocol protocol, boolean isClosed) throws SQLException Handle failover on master or slave connection.- Specified by:
handleFailoverin interfaceListener- Overrides:
handleFailoverin classAbstractMastersListener- Parameters:
method- called methodargs- methods parametersprotocol- current protocol- Returns:
- HandleErrorResult object to indicate if query has finally been relaunched or exception if not.
- Throws:
SQLException- if primary fail reconnection fails
-
resetMasterFailoverData
protected void resetMasterFailoverData()- Overrides:
resetMasterFailoverDatain classAbstractMastersListener
-
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:
hasHostFailin interfaceListener- Overrides:
hasHostFailin classAbstractMastersListener
-
getFilterForFailedHost
- Specified by:
getFilterForFailedHostin interfaceListener- Overrides:
getFilterForFailedHostin classAbstractMastersListener
-
secondaryFail
public abstract HandleErrorResult secondaryFail(Method method, Object[] args, boolean killCmd) throws SQLException - Throws:
SQLException
-
foundActiveSecondary
- Throws:
SQLException
-