| 限定符和类型 | 字段和说明 |
|---|---|
protected AtomicInteger |
currentConnectionAttempts |
protected Protocol |
currentProtocol |
protected boolean |
currentReadOnlyAsked |
protected AtomicBoolean |
explicitClosed |
protected GlobalStateInfo |
globalInfo |
protected long |
lastQueryNanos |
protected long |
lastRetry |
protected static Logger |
lockLogger |
protected FailoverProxy |
proxy |
UrlParser |
urlParser |
| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractMastersListener(UrlParser urlParser,
GlobalStateInfo globalInfo) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
abortConnection(Protocol protocol)
Utility to force close existing connection.
|
void |
addToBlacklist(HostAddress hostAddress)
After a failover, put the hostAddress in a static list so the other connection will not take
this host in account for a time.
|
void |
addToPickedList(HostAddress hostAddress) |
boolean |
canRetryFailLoop() |
abstract boolean |
checkMasterStatus(SearchFilter searchFilter) |
static void |
clearBlacklist()
Clear blacklist data.
|
void |
closeConnection(Protocol protocol)
Utility to close existing connection.
|
ConcurrentMap<HostAddress,HostStateInfo> |
getBlacklist() |
Set<HostAddress> |
getBlacklistKeys() |
String |
getCatalog() |
LoadBalanceInfo |
getCurrentLoadBalanceInfo() |
Protocol |
getCurrentProtocol() |
SearchFilter |
getFilterForFailedHost() |
long |
getLastQueryNanos() |
int |
getMajorServerVersion() |
long |
getMasterHostFailNanos() |
Set<HostAddress> |
getPickedlist() |
FailoverProxy |
getProxy() |
int |
getRetriesAllDown() |
int |
getRetryAllDowns() |
int |
getTimeout() |
UrlParser |
getUrlParser() |
abstract void |
handleFailLoop() |
HandleErrorResult |
handleFailover(SQLException qe,
Method method,
Object[] args,
Protocol protocol,
boolean isClosed)
Call when a failover is detected on master connection.
|
boolean |
hasHostFail() |
void |
initializeConnection()
Initialize Listener.
|
boolean |
inTransaction() |
Object |
invoke(Method method,
Object[] args) |
Object |
invoke(Method method,
Object[] args,
Protocol specificProtocol) |
boolean |
isAutoReconnect() |
boolean |
isClosed() |
boolean |
isExplicitClosed() |
boolean |
isMasterConnection() |
boolean |
isMasterHostFail() |
boolean |
isQueryRelaunchable(Method method,
Object[] args)
Check if query can be re-executed.
|
boolean |
isReadOnly() |
boolean |
isServerMariaDb() |
boolean |
isValid(int timeout) |
boolean |
noBackslashEscapes() |
protected boolean |
pingMasterProtocol(Protocol protocol) |
protected void |
preAutoReconnect() |
abstract void |
preClose() |
abstract void |
preExecute() |
abstract HandleErrorResult |
primaryFail(Method method,
Object[] args,
boolean killCmd,
boolean isClosed) |
void |
prolog(long maxRows,
OceanBaseConnection connection,
OceanBaseStatement statement) |
abstract void |
reconnect() |
abstract void |
reconnectFailedConnection(SearchFilter filter) |
HandleErrorResult |
relaunchOperation(Method method,
Object[] args)
After a failover that has bean done, relaunch the operation that was in progress.
|
void |
removeFromBlacklist(HostAddress hostAddress)
After a successfull connection, permit to remove a hostAddress from blacklist.
|
void |
removeFromPickedList(HostAddress hostAddress) |
protected void |
removeListenerFromSchedulers() |
void |
resetHostStateInfo(HostAddress hostAddress) |
void |
resetMasterFailoverData() |
void |
resetOldsBlackListHosts()
Permit to remove Host to blacklist after loadBalanceBlacklistTimeout seconds.
|
boolean |
sessionStateAware() |
void |
setCurrentLoadBalanceInfo(LoadBalanceInfo loadBalanceInfo) |
boolean |
setMasterHostFail()
Set master fail variables.
|
void |
setProxy(FailoverProxy proxy) |
void |
setRetryAllDowns(int retryAllDowns) |
protected void |
setSessionReadOnly(boolean readOnly,
Protocol protocol) |
abstract void |
switchReadOnlyConnection(Boolean readonly) |
void |
syncConnection(Protocol from,
Protocol to)
When switching between 2 connections, report existing connection parameter to the new used
connection.
|
void |
throwFailoverMessage(HostAddress failHostAddress,
boolean wasMaster,
SQLException queryException,
boolean reconnected)
Throw a human readable message after a failoverException.
|
boolean |
versionGreaterOrEqual(int major,
int minor,
int patch) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfoundActiveMaster, getServerThreadId, isMasterConnected, preAbort, rePrepareOnSlave, resetpublic final UrlParser urlParser
protected final AtomicInteger currentConnectionAttempts
protected final AtomicBoolean explicitClosed
protected final GlobalStateInfo globalInfo
protected volatile boolean currentReadOnlyAsked
protected Protocol currentProtocol
protected FailoverProxy proxy
protected long lastRetry
protected long lastQueryNanos
protected static final Logger lockLogger
protected AbstractMastersListener(UrlParser urlParser, GlobalStateInfo globalInfo)
public void setCurrentLoadBalanceInfo(LoadBalanceInfo loadBalanceInfo)
setCurrentLoadBalanceInfo 在接口中 Listenerpublic LoadBalanceInfo getCurrentLoadBalanceInfo()
getCurrentLoadBalanceInfo 在接口中 Listenerpublic void setRetryAllDowns(int retryAllDowns)
setRetryAllDowns 在接口中 Listenerpublic int getRetryAllDowns()
getRetryAllDowns 在接口中 Listenerpublic static void clearBlacklist()
public void initializeConnection()
throws SQLException
initializeConnection 在接口中 ListenerSQLException - if any exception occur.protected void removeListenerFromSchedulers()
protected void preAutoReconnect()
throws SQLException
SQLExceptionpublic FailoverProxy getProxy()
public void setProxy(FailoverProxy proxy)
public Set<HostAddress> getPickedlist()
public void addToPickedList(HostAddress hostAddress)
addToPickedList 在接口中 ListenerhostAddress - the HostAddress has failed to connect but not triggered the blacklist AppendStrategypublic void removeFromPickedList(HostAddress hostAddress)
removeFromPickedList 在接口中 Listenerpublic Set<HostAddress> getBlacklistKeys()
getBlacklistKeys 在接口中 Listenerpublic ConcurrentMap<HostAddress,HostStateInfo> getBlacklist()
getBlacklist 在接口中 Listenerpublic HandleErrorResult handleFailover(SQLException qe, Method method, Object[] args, Protocol protocol, boolean isClosed) throws SQLException
handleFailover 在接口中 Listenermethod - called methodargs - methods parametersprotocol - current protocolSQLException - when method and parameters does not exist.public void addToBlacklist(HostAddress hostAddress)
addToBlacklist 在接口中 ListenerhostAddress - the HostAddress to add to blacklistpublic void removeFromBlacklist(HostAddress hostAddress)
removeFromBlacklist 在接口中 ListenerhostAddress - the host address which is going to be removed from blacklistpublic void resetHostStateInfo(HostAddress hostAddress)
resetHostStateInfo 在接口中 Listenerpublic void resetOldsBlackListHosts()
resetOldsBlackListHosts 在接口中 Listenerpublic void resetMasterFailoverData()
protected void setSessionReadOnly(boolean readOnly,
Protocol protocol)
throws SQLException
SQLExceptionpublic abstract void handleFailLoop()
public Protocol getCurrentProtocol()
getCurrentProtocol 在接口中 Listenerpublic long getMasterHostFailNanos()
public boolean setMasterHostFail()
setMasterHostFail 在接口中 Listenerpublic boolean isMasterHostFail()
isMasterHostFail 在接口中 Listenerpublic boolean hasHostFail()
hasHostFail 在接口中 Listenerpublic SearchFilter getFilterForFailedHost()
getFilterForFailedHost 在接口中 Listenerpublic HandleErrorResult relaunchOperation(Method method, Object[] args) throws SQLException
method - the method accessedargs - the parametersSQLException - if there is any error relaunching initial methodpublic boolean isQueryRelaunchable(Method method, Object[] args)
method - invoke methodargs - invoke argumentspublic Object invoke(Method method, Object[] args, Protocol specificProtocol) throws Throwable
public void syncConnection(Protocol from, Protocol to) throws SQLException
syncConnection 在接口中 Listenerfrom - used connectionto - will-be-current connectionSQLException - if catalog cannot be setpublic boolean versionGreaterOrEqual(int major,
int minor,
int patch)
versionGreaterOrEqual 在接口中 Listenerpublic boolean isServerMariaDb()
isServerMariaDb 在接口中 Listenerpublic boolean sessionStateAware()
sessionStateAware 在接口中 Listenerpublic boolean noBackslashEscapes()
noBackslashEscapes 在接口中 Listenerpublic int getMajorServerVersion()
getMajorServerVersion 在接口中 Listenerpublic boolean isValid(int timeout)
throws SQLException
isValid 在接口中 ListenerSQLExceptionpublic boolean isReadOnly()
isReadOnly 在接口中 Listenerpublic boolean inTransaction()
inTransaction 在接口中 Listenerpublic boolean isMasterConnection()
isMasterConnection 在接口中 Listenerpublic boolean isExplicitClosed()
isExplicitClosed 在接口中 Listenerpublic int getRetriesAllDown()
getRetriesAllDown 在接口中 Listenerpublic boolean isAutoReconnect()
isAutoReconnect 在接口中 Listenerpublic UrlParser getUrlParser()
getUrlParser 在接口中 Listenerpublic abstract void preExecute()
throws SQLException
preExecute 在接口中 ListenerSQLExceptionpublic abstract void reconnectFailedConnection(SearchFilter filter) throws SQLException
reconnectFailedConnection 在接口中 ListenerSQLExceptionpublic abstract void switchReadOnlyConnection(Boolean readonly) throws SQLException
switchReadOnlyConnection 在接口中 ListenerSQLExceptionpublic abstract HandleErrorResult primaryFail(Method method, Object[] args, boolean killCmd, boolean isClosed) throws SQLException
primaryFail 在接口中 ListenerSQLExceptionpublic void throwFailoverMessage(HostAddress failHostAddress, boolean wasMaster, SQLException queryException, boolean reconnected) throws SQLException
throwFailoverMessage 在接口中 ListenerfailHostAddress - failedHostAddresswasMaster - was failed connection masterqueryException - internal errorreconnected - connection statusSQLException - error with failover informationpublic boolean canRetryFailLoop()
canRetryFailLoop 在接口中 Listenerpublic void prolog(long maxRows,
OceanBaseConnection connection,
OceanBaseStatement statement)
throws SQLException
prolog 在接口中 ListenerSQLExceptionpublic String getCatalog() throws SQLException
getCatalog 在接口中 ListenerSQLExceptionpublic int getTimeout()
throws SocketException
getTimeout 在接口中 ListenerSocketExceptionpublic abstract void reconnect()
throws SQLException
reconnect 在接口中 ListenerSQLExceptionpublic abstract boolean checkMasterStatus(SearchFilter searchFilter)
checkMasterStatus 在接口中 Listenerpublic long getLastQueryNanos()
getLastQueryNanos 在接口中 Listenerprotected boolean pingMasterProtocol(Protocol protocol)
public void closeConnection(Protocol protocol)
protocol - connection to close.public void abortConnection(Protocol protocol)
protocol - connection to close.Copyright © 2024 oceanbase.com. All rights reserved.