# Class AuroraListener

java.lang.Object
org.mariadb.jdbc.internal.failover.AbstractMastersListener
org.mariadb.jdbc.internal.failover.AbstractMastersReplicasListener
org.mariadb.jdbc.internal.failover.impl.MastersReplicasListener
org.mariadb.jdbc.internal.failover.impl.AuroraListener

All Implemented Interfaces:
  `Listener`

public class AuroraListener extends MastersReplicasListener

## Field Summary

### Fields inherited from class MastersReplicasListener

`hostAddresses, masterProtocol, secondaryProtocol`

### Fields inherited from class AbstractMastersReplicasListener

`waitNewMasterProtocol, waitNewSecondaryProtocol`

### Fields inherited from class AbstractMastersListener

`currentConnectionAttempts, currentProtocol, currentReadOnlyAsked, explicitClosed, globalInfo, lastQueryNanos, lastRetry, proxy, urlParser`

## Constructor Summary

Constructors
Constructor
Description
`AuroraListener(UrlParser urlParser, GlobalStateInfo globalInfo)`
Constructor for Aurora.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`checkMasterStatus(SearchFilter searchFilter)`
Check master status.
`String`
`getClusterDnsSuffix()`
`HostAddress`
`getClusterHostAddress()`
`void`
`reconnectFailedConnection(SearchFilter initialSearchFilter)`
Search a valid connection for failed one.
`List<HostAddress>`
`retrieveAllEndpointsAndSet(Protocol protocol)`
Retrieves the information necessary to add a new endpoint.
`HostAddress`
`searchByStartName(Protocol secondaryProtocol, List<HostAddress> loopAddress)`
Looks for the current master/writer instance via the secondary protocol if it is found within 3 attempts.

### Methods inherited from class MastersReplicasListener

`checkInitialConnection, checkWaitingConnection, connectedHosts, foundActiveMaster, foundActiveSecondary, getCatalog, getMajorServerVersion, getServerThreadId, getTimeout, handleFailLoop, initializeConnection, inTransaction, invoke, isClosed, isMasterConnected, isMasterConnection, isServerMariaDb, isValid, lockAndSwitchMaster, lockAndSwitchSecondary, noBackslashEscapes, preAbort, preClose, preExecute, primaryFail, prolog, reconnect, removeListenerFromSchedulers, rePrepareOnReplica, reset, secondaryFail, sessionStateAware, switchReadOnlyConnection, versionGreaterOrEqual`

### Methods inherited from class AbstractMastersReplicasListener

`getFilterForFailedHost, getSecondaryHostFailNanos, handleFailover, hasHostFail, isMasterHostFailReconnect, isSecondaryHostFail, isSecondaryHostFailReconnect, resetMasterFailoverData, resetSecondaryFailoverData, setSecondaryHostFail`

### Methods inherited from class AbstractMastersListener

`abortConnection, addToBlacklist, canRetryFailLoop, clearBlacklist, closeConnection, getBlacklistKeys, getCurrentProtocol, getLastQueryNanos, getMasterHostFailNanos, getProxy, getRetriesAllDown, getUrlParser, invoke, isAutoReconnect, isExplicitClosed, isMasterHostFail, isQueryRelaunchable, isReadOnly, pingMasterProtocol, preAutoReconnect, relaunchOperation, removeFromBlacklist, resetOldsBlackListHosts, setMasterHostFail, setProxy, setSessionReadOnly, syncConnection, throwFailoverMessage`

### Methods inherited from class Object

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

## Constructor Details

### AuroraListener

public AuroraListener(UrlParser urlParser, GlobalStateInfo globalInfo) throws SQLException
Constructor for Aurora. This differ from standard failover because : - we don't know current master, we must check that after initial connection - master can change after he has a failover

Parameters:
  `urlParser` - connection information
  `globalInfo` - server global variables information
Throws:
  `SQLException` - when connection string contain host with different cluster

## Method Details

### getClusterDnsSuffix

public String getClusterDnsSuffix()

### getClusterHostAddress

public HostAddress getClusterHostAddress()

### reconnectFailedConnection

public void reconnectFailedConnection(SearchFilter initialSearchFilter) throws SQLException
Search a valid connection for failed one. A Node can be a master or a replica depending on the cluster state. so search for each host until found all the failed connection. By default, search for the host not down, and recheck the down one after if not found valid connections.

Specified by:
  `reconnectFailedConnection` in interface `Listener`
Overrides:
  `reconnectFailedConnection` in class `MastersReplicasListener`
Parameters:
  `initialSearchFilter` - initial search filter
Throws:
  `SQLException` - if a connection asked is not found

### retrieveAllEndpointsAndSet

public List<HostAddress> retrieveAllEndpointsAndSet(Protocol protocol) throws SQLException
Retrieves the information necessary to add a new endpoint. Calls the methods that retrieves the instance identifiers and sets urlParser accordingly.

Parameters:
  `protocol` - current protocol connected to
Returns:
  host address list
Throws:
  `SQLException` - if connection error occur

### searchByStartName

public HostAddress searchByStartName(Protocol secondaryProtocol, List<HostAddress> loopAddress)
Looks for the current master/writer instance via the secondary protocol if it is found within 3 attempts. Should it not be able to connect, the host is blacklisted and null is returned. Otherwise, it will open a new connection to the cluster endpoint and retrieve the data from there.

Parameters:
  `secondaryProtocol` - the current secondary protocol
  `loopAddress` - list of possible hosts
Returns:
  the probable master address or null if not found

### checkMasterStatus

public boolean checkMasterStatus(SearchFilter searchFilter)
Description copied from class: `MastersReplicasListener`
Check master status.

Specified by:
  `checkMasterStatus` in interface `Listener`
Overrides:
  `checkMasterStatus` in class `MastersReplicasListener`
Parameters:
  `searchFilter` - search filter
Returns:
  has some status changed