public class AuroraListener extends MastersSlavesListener
Modifier and Type | Field and Description |
---|---|
private HostAddress |
clusterHostAddress |
private java.util.regex.Pattern |
clusterPattern |
private java.util.logging.Logger |
log |
private java.lang.String |
urlEndStr |
masterProtocol, secondaryProtocol
waitNewMasterProtocol, waitNewSecondaryProtocol
currentConnectionAttempts, currentProtocol, currentReadOnlyAsked, explicitClosed, lastQueryNanos, lastRetry, proxy, urlParser
Constructor and Description |
---|
AuroraListener(UrlParser urlParser)
Constructor for Aurora.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkMasterStatus(SearchFilter searchFilter)
Check master status.
|
private HostAddress |
findClusterHostAddress(UrlParser urlParser)
Retrieves the cluster host address from the UrlParser instance.
|
HostAddress |
getClusterHostAddress() |
private java.util.List<java.lang.String> |
getCurrentEndpointIdentifiers(Protocol protocol)
Retrieves all endpoints of a cluster from the appropriate database table.
|
void |
reconnectFailedConnection(SearchFilter searchFilter)
Search a valid connection for failed one.
|
void |
retrieveAllEndpointsAndSet(Protocol protocol)
Retrieves the information necessary to add a new endpoint.
|
HostAddress |
searchByStartName(Protocol secondaryProtocol,
java.util.List<HostAddress> loopAddress)
Looks for the current master/writer instance via the secondary protocol if it is found within 3 attempts.
|
private HostAddress |
searchForMasterHostAddress(Protocol protocol,
java.util.List<HostAddress> loopAddress)
Aurora replica doesn't have the master endpoint but the master instance name.
|
private void |
setUrlParserFromEndpoints(java.util.List<java.lang.String> endpoints,
int port)
Sets urlParser accordingly to discovered hosts.
|
checkInitialConnection, checkWaitingConnection, foundActiveMaster, foundActiveSecondary, handleFailLoop, initializeConnection, isMasterConnected, lockAndSwitchMaster, lockAndSwitchSecondary, preClose, preExecute, primaryFail, reconnect, removeListenerFromSchedulers, rePrepareOnSlave, secondaryFail, switchReadOnlyConnection
getFilterForFailedHost, getSecondaryHostFailNanos, handleFailover, hasHostFail, isMasterHostFailReconnect, isSecondaryHostFail, isSecondaryHostFailReconnect, resetMasterFailoverData, resetSecondaryFailoverData, setSecondaryHostFail
addToBlacklist, canRetryFailLoop, clearBlacklist, closeConnection, getBlacklistKeys, getCurrentProtocol, getLastQueryNanos, getMasterHostFailNanos, getProxy, getRetriesAllDown, getUrlParser, invoke, invoke, isAutoReconnect, isClosed, isExplicitClosed, isMasterHostFail, isQueryRelaunchable, isReadOnly, pingMasterProtocol, preAutoReconnect, relaunchOperation, removeFromBlacklist, resetOldsBlackListHosts, setMasterHostFail, setProxy, setSessionReadOnly, syncConnection, throwFailoverMessage
private final java.util.logging.Logger log
private final java.util.regex.Pattern clusterPattern
private final HostAddress clusterHostAddress
private java.lang.String urlEndStr
public AuroraListener(UrlParser urlParser)
urlParser
- connection informationsprivate HostAddress findClusterHostAddress(UrlParser urlParser)
urlParser
- object that holds the connection informationpublic HostAddress getClusterHostAddress()
public void reconnectFailedConnection(SearchFilter searchFilter) throws java.sql.SQLException
reconnectFailedConnection
in interface Listener
reconnectFailedConnection
in class MastersSlavesListener
java.sql.SQLException
- if a connection asked is not foundpublic void retrieveAllEndpointsAndSet(Protocol protocol) throws java.sql.SQLException
protocol
- current protocol connected tojava.sql.SQLException
- if connection error occurprivate java.util.List<java.lang.String> getCurrentEndpointIdentifiers(Protocol protocol) throws java.sql.SQLException
protocol
- current protocol connected tojava.sql.SQLException
- if connection error occurprivate void setUrlParserFromEndpoints(java.util.List<java.lang.String> endpoints, int port)
endpoints
- instance identifiersport
- port that is common to all endpointspublic HostAddress searchByStartName(Protocol secondaryProtocol, java.util.List<HostAddress> loopAddress)
secondaryProtocol
- the current secondary protocolloopAddress
- list of possible hostsprivate HostAddress searchForMasterHostAddress(Protocol protocol, java.util.List<HostAddress> loopAddress) throws java.sql.SQLException
protocol
- current protocolloopAddress
- list of possible hostsjava.sql.SQLException
- if any connection error occurpublic boolean checkMasterStatus(SearchFilter searchFilter)
MastersSlavesListener
checkMasterStatus
in interface Listener
checkMasterStatus
in class MastersSlavesListener
searchFilter
- search filter