org.mariadb.jdbc.internal.mysql.listener.impl

## Class MastersFailoverListener

- java.lang.Object
- - org.mariadb.jdbc.internal.mysql.listener.AbstractMastersListener
  - - org.mariadb.jdbc.internal.mysql.listener.impl.MastersFailoverListener

All Implemented Interfaces:
  Listener

    public class MastersFailoverListener
    extends AbstractMastersListener

### Nested Class Summary

### Nested classes/interfaces inherited from class org.mariadb.jdbc.internal.mysql.listener.AbstractMastersListener

`AbstractMastersListener.FailLoop`

### Field Summary

### Fields inherited from class org.mariadb.jdbc.internal.mysql.listener.AbstractMastersListener

`blacklist, currentConnectionAttempts, currentProtocol, currentReadOnlyAsked, executorService, explicitClosed, isLooping, jdbcUrl, lastRetry, proxy, scheduledFailover`

### Constructor Summary

Constructors
Constructor and Description
`MastersFailoverListener(JDBCUrl jdbcUrl)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `foundActiveMaster(Protocol protocol)` method called when a new Master connection is found after a fallback
`void` `initializeConnection()`
`void` `preClose()`
`void` `preExecute()`
`HandleErrorResult` `primaryFail(Method method, Object[] args)`
`void` `reconnect()`
`void` `reconnectFailedConnection(SearchFilter searchFilter)` Loop to connect
`boolean` `shouldReconnect()`
`void` `switchReadOnlyConnection(Boolean mustBeReadOnly)`
`void` `throwFailoverMessage(QueryException queryException, boolean reconnected)` Throw a human readable message after a failoverException

### Methods inherited from class org.mariadb.jdbc.internal.mysql.listener.AbstractMastersListener

`addToBlacklist, getBlacklist, getCurrentProtocol, getFilterForFailedHost, getInitialTimeout, getJdbcUrl, getMasterHostFailTimestamp, getProxy, getRetriesAllDown, handleFailover, hasHostFail, invoke, isAutoReconnect, isClosed, isExplicitClosed, isMasterHostFail, isReadOnly, launchFailLoopIfNotlaunched, relaunchOperation, resetMasterFailoverData, resetOldsBlackListHosts, setExplicitClosed, setMasterHostFail, setProxy, setSessionReadOnly, stopFailover, syncConnection`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MastersFailoverListener

    public MastersFailoverListener(JDBCUrl jdbcUrl)

### Method Detail

#### initializeConnection

    public void initializeConnection()
                              throws QueryException

Specified by:
  `initializeConnection` in interface `Listener`
Specified by:
  `initializeConnection` in class `AbstractMastersListener`
Throws:
  `QueryException`

#### preExecute

    public void preExecute()
                    throws QueryException

Specified by:
  `preExecute` in interface `Listener`
Specified by:
  `preExecute` in class `AbstractMastersListener`
Throws:
  `QueryException`

#### shouldReconnect

    public boolean shouldReconnect()

Specified by:
  `shouldReconnect` in interface `Listener`
Specified by:
  `shouldReconnect` in class `AbstractMastersListener`

#### preClose

    public void preClose()
                  throws SQLException

Specified by:
  `preClose` in interface `Listener`
Specified by:
  `preClose` in class `AbstractMastersListener`
Throws:
  `SQLException`

#### primaryFail

    public HandleErrorResult primaryFail(Method method,
                                         Object[] args)
                                  throws Throwable

Specified by:
  `primaryFail` in interface `Listener`
Specified by:
  `primaryFail` in class `AbstractMastersListener`
Throws:
  `Throwable`

#### reconnectFailedConnection

    public void reconnectFailedConnection(SearchFilter searchFilter)
                                   throws QueryException

Loop to connect

Specified by:
  `reconnectFailedConnection` in interface `Listener`
Specified by:
  `reconnectFailedConnection` in class `AbstractMastersListener`
Throws:
  `QueryException` - if there is any error during reconnection
  `QueryException` - sqlException

#### switchReadOnlyConnection

    public void switchReadOnlyConnection(Boolean mustBeReadOnly)
                                  throws QueryException

Specified by:
  `switchReadOnlyConnection` in interface `Listener`
Specified by:
  `switchReadOnlyConnection` in class `AbstractMastersListener`
Throws:
  `QueryException`

#### foundActiveMaster

    public void foundActiveMaster(Protocol protocol)
                           throws QueryException

method called when a new Master connection is found after a fallback

Parameters:
  `protocol` - the new active connection
Throws:
  `QueryException`

#### throwFailoverMessage

    public void throwFailoverMessage(QueryException queryException,
                                     boolean reconnected)
                              throws QueryException

Throw a human readable message after a failoverException

Specified by:
  `throwFailoverMessage` in interface `Listener`
Specified by:
  `throwFailoverMessage` in class `AbstractMastersListener`
Parameters:
  `queryException` - internal error
  `reconnected` - connection status
Throws:
  `QueryException` - error with failover information

#### reconnect

    public void reconnect()
                   throws QueryException

Specified by:
  `reconnect` in interface `Listener`
Specified by:
  `reconnect` in class `AbstractMastersListener`
Throws:
  `QueryException`