|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mariadb.jdbc.internal.failover.AbstractMastersListener
org.mariadb.jdbc.internal.failover.impl.MastersFailoverListener
public class MastersFailoverListener
| Field Summary |
|---|
| Fields inherited from class org.mariadb.jdbc.internal.failover.AbstractMastersListener |
|---|
currentConnectionAttempts, currentProtocol, currentReadOnlyAsked, explicitClosed, lastQueryNanos, lastRetry, proxy, urlParser |
| Constructor Summary | |
|---|---|
MastersFailoverListener(UrlParser urlParser)
Initialisation. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MastersFailoverListener(UrlParser urlParser)
urlParser - url options.| Method Detail |
|---|
public void initializeConnection()
throws SQLException
initializeConnection in interface ListenerinitializeConnection in class AbstractMastersListenerSQLException - if connection is on error.
public void preExecute()
throws SQLException
preExecute in interface ListenerpreExecute in class AbstractMastersListenerSQLException - if connection has been explicitly closed.
public void preClose()
throws SQLException
preClose in interface ListenerpreClose in class AbstractMastersListenerSQLException
public HandleErrorResult primaryFail(Method method,
Object[] args)
throws Throwable
primaryFail in interface ListenerprimaryFail in class AbstractMastersListenerThrowable
public void reconnectFailedConnection(SearchFilter searchFilter)
throws SQLException
reconnectFailedConnection in interface ListenerreconnectFailedConnection in class AbstractMastersListenersearchFilter - search parameters.
SQLException - if there is any error during reconnection
public void switchReadOnlyConnection(Boolean mustBeReadOnly)
throws SQLException
switchReadOnlyConnection in interface ListenerswitchReadOnlyConnection in class AbstractMastersListenermustBeReadOnly - is read-only flag
SQLException - if a connection error occur
public void foundActiveMaster(Protocol protocol)
throws SQLException
protocol - the new active connection
SQLException
public void reconnect()
throws SQLException
reconnect in interface Listenerreconnect in class AbstractMastersListenerSQLException - 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 filter
public void rePrepareOnSlave(ServerPrepareResult oldServerPrepareResult,
boolean mustExecuteOnSlave)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||