public class MastersFailoverListener extends AbstractMastersListener
currentConnectionAttempts, currentProtocol, currentReadOnlyAsked, explicitClosed, lastQueryNanos, lastRetry, proxy, urlParser| Constructor and Description |
|---|
MastersFailoverListener(UrlParser urlParser)
Initialisation.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkMasterStatus(SearchFilter searchFilter)
Check master status.
|
void |
foundActiveMaster(Protocol protocol)
method called when a new Master connection is found after a fallback.
|
void |
handleFailLoop()
Add listener to FailoverLoop if master connection is not active, so a reconnection will be done.
|
void |
initializeConnection()
Connect to database.
|
boolean |
isMasterConnected() |
void |
preClose() |
void |
preExecute()
Before executing query, reconnect if connection is closed, and autoReconnect option is set.
|
HandleErrorResult |
primaryFail(Method method,
Object[] args) |
void |
reconnect()
Try to reconnect connection.
|
void |
reconnectFailedConnection(SearchFilter searchFilter)
Loop to connect failed hosts.
|
void |
rePrepareOnSlave(ServerPrepareResult oldServerPrepareResult,
boolean mustExecuteOnSlave) |
void |
switchReadOnlyConnection(Boolean mustBeReadOnly)
Force session to read-only according to options.
|
addToBlacklist, canRetryFailLoop, clearBlacklist, closeConnection, getBlacklistKeys, getCurrentProtocol, getFilterForFailedHost, getLastQueryNanos, getMasterHostFailNanos, getProxy, getRetriesAllDown, getUrlParser, handleFailover, hasHostFail, invoke, invoke, isAutoReconnect, isClosed, isExplicitClosed, isMasterHostFail, isQueryRelaunchable, isReadOnly, pingMasterProtocol, preAutoReconnect, relaunchOperation, removeFromBlacklist, removeListenerFromSchedulers, resetMasterFailoverData, resetOldsBlackListHosts, setMasterHostFail, setProxy, setSessionReadOnly, syncConnection, throwFailoverMessagepublic MastersFailoverListener(UrlParser urlParser)
urlParser - url options.public void initializeConnection()
throws QueryException
initializeConnection in interface ListenerinitializeConnection in class AbstractMastersListenerQueryException - if connection is on error.public void preExecute()
throws QueryException
preExecute in interface ListenerpreExecute in class AbstractMastersListenerQueryException - if connection has been explicitly closed.public void preClose()
throws SQLException
preClose in interface ListenerpreClose in class AbstractMastersListenerSQLExceptionpublic HandleErrorResult primaryFail(Method method, Object[] args) throws Throwable
primaryFail in interface ListenerprimaryFail in class AbstractMastersListenerThrowablepublic void reconnectFailedConnection(SearchFilter searchFilter) throws QueryException
reconnectFailedConnection in interface ListenerreconnectFailedConnection in class AbstractMastersListenersearchFilter - search parameters.QueryException - if there is any error during reconnectionpublic void switchReadOnlyConnection(Boolean mustBeReadOnly) throws QueryException
switchReadOnlyConnection in interface ListenerswitchReadOnlyConnection in class AbstractMastersListenermustBeReadOnly - is read-only flagQueryException - if a connection error occurpublic void foundActiveMaster(Protocol protocol) throws QueryException
protocol - the new active connectionQueryExceptionpublic void reconnect()
throws QueryException
reconnect in interface Listenerreconnect in class AbstractMastersListenerQueryException - if reconnect a new connection but there was an active transaction.public void handleFailLoop()
handleFailLoop in class AbstractMastersListenerpublic boolean isMasterConnected()
public boolean checkMasterStatus(SearchFilter searchFilter)
checkMasterStatus in interface ListenercheckMasterStatus in class AbstractMastersListenersearchFilter - search filterpublic void rePrepareOnSlave(ServerPrepareResult oldServerPrepareResult, boolean mustExecuteOnSlave)
Copyright © 2017. All rights reserved.