public abstract class AbstractConnectProtocol extends Object implements Protocol
| Constructor and Description |
|---|
AbstractConnectProtocol(UrlParser urlParser,
GlobalStateInfo globalInfo,
ReentrantLock lock,
LruTraceCache traceCache)
Get a protocol instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Force closes socket and stream readers/writers.
|
void |
changeSocketSoTimeout(int setSoTimeout) |
void |
changeSocketTcpNoDelay(boolean setTcpNoDelay)
Change Socket TcpNoDelay option.
|
boolean |
checkIfMaster()
Check that current connection is a master connection (not read-only).
|
protected void |
cleanMemory() |
void |
close()
Closes socket and stream readers/writers Attempts graceful shutdown.
|
void |
connect()
Connect to currentHost.
|
void |
connectWithoutProxy()
Connect without proxy.
|
void |
destroySocket()
Closing socket in case of Connection error after socket creation.
|
abstract void |
executeQuery(String sql) |
Results |
getActiveStreamingResult() |
String |
getDatabase() |
String |
getEncoding() |
String |
getFullLinkTraceAction() |
String |
getFullLinkTraceClientInfo() |
String |
getFullLinkTraceIdentifier() |
byte |
getFullLinkTraceLevel() |
String |
getFullLinkTraceModule() |
double |
getFullLinkTracePrintSamplePercentage() |
byte |
getFullLinkTraceRecordPolicy() |
double |
getFullLinkTraceSamplePercentage() |
long |
getFullLinkTraceSlowQueryThreshold() |
String |
getHost() |
HostAddress |
getHostAddress() |
ReentrantLock |
getLock() |
int |
getMajorServerVersion() |
int |
getMinorServerVersion() |
String |
getObServerVersion() |
Options |
getOptions() |
boolean |
getPinGlobalTxToPhysicalConnection() |
int |
getPort() |
FailoverProxy |
getProxy() |
PacketInputStream |
getReader() |
boolean |
getReadonly() |
long |
getServerThreadId() |
TimeZone |
getServerTimeZone() |
String |
getServerVersion() |
Socket |
getSocket() |
TimeZone |
getTimeZone() |
String |
getTraces()
Get a String containing readable information about last 10 send/received packets.
|
UrlParser |
getUrlParser() |
String |
getUsername() |
PacketOutputStream |
getWriter() |
boolean |
hasMoreResults() |
boolean |
hasWarnings()
Has warnings.
|
boolean |
isClosed()
Is the connection closed.
|
boolean |
isConnected()
Is connected.
|
boolean |
isEofDeprecated() |
boolean |
isExplicitClosed() |
boolean |
isMasterConnection()
Indicate if current protocol is a master protocol.
|
boolean |
isOracleMode() |
boolean |
isServerMariaDb() |
boolean |
isTZTablesImported() |
boolean |
mustBeMasterConnection() |
boolean |
noBackslashEscapes() |
void |
parseVersion(String serverVersion) |
protected void |
postConnectionQueries() |
ServerPrepareStatementCache |
prepareStatementCache() |
void |
readEofPacket()
Check that next read packet is a End-of-file packet.
|
void |
readPipelineCheckMaster()
Deprecated.
|
void |
removeActiveStreamingResult()
Remove exception result and since totally fetched, set fetch size to 0.
|
void |
removeHasMoreResults()
Remove flag has more results.
|
boolean |
sessionStateAware() |
void |
setActiveStreamingResult(Results activeStreamingResult) |
void |
setFullLinkTraceAction(String action) |
void |
setFullLinkTraceClientInfo(String clientInfo) |
void |
setFullLinkTraceIdentifier(String clientIdentifier) |
void |
setFullLinkTraceModule(String module,
String action) |
void |
setHasWarnings(boolean hasWarnings) |
void |
setHostAddress(HostAddress host) |
void |
setHostFailedWithoutProxy() |
void |
setObServerVersion(String version) |
void |
setOracleMode(boolean oracleMode) |
void |
setProxy(FailoverProxy proxy) |
void |
setServerStatus(short serverStatus) |
boolean |
shouldReconnectWithoutProxy()
Indicate for Old reconnection if can reconnect without throwing exception.
|
void |
skip()
Skip packets not read that are not needed.
|
void |
skipEofPacket()
Check that next read packet is a End-of-file packet.
|
boolean |
supportFetchWithOffset() |
boolean |
supportStmtPrepareExecute() |
boolean |
useOceanBaseProtocolV20() |
boolean |
versionGreaterOrEqual(int major,
int minor,
int patch)
Utility method to check if database version is greater than parameters.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPrepareInCache, cancelCurrentQuery, changeUser, clearNetworkStatistics, closeExplicit, executeBatchClient, executeBatchServer, executeBatchStmt, executePreparedQuery, executePreparedQuery, executePreparedQueryArrayBinding, executePreparedQueryArrayBinding, executeQuery, executeQuery, executeQuery, executeQuery, fetchRowViaCursor, fetchRowViaCursorForOracle, forceReleasePrepareStatement, forceReleaseWaitingPrepareStatement, getAutocommit, getAutoIncrementIncrement, getCatalog, getChecksum, getExecuteMode, getIterationCount, getLastPacketCostTime, getLastPacketResponseTimestamp, getLastPacketSendTimestamp, getMaxRows, getNetworkStatisticsFlag, getResult, getTimeout, getTransactionIsolationLevel, handleIoException, interrupt, inTransaction, isInterrupted, isValid, ping, prepare, prolog, prologProxy, readErrorPacket, readOkPacket, readResultSet, releasePrepareStatement, reset, resetChecksum, resetDatabase, resetStateAfterFailover, rollback, setActiveFutureTask, setAutoCommit, setCatalog, setChecksum, setComStmtPrepareExecuteField, setExecuteMode, setIterationCount, setLocalInfileInputStream, setMaxRows, setNetworkStatisticsFlag, setReadonly, setTimeout, setTransactionIsolation, setUsername, stopIfInterruptedprotected static final String CHECK_GALERA_STATE_QUERY
protected final ReentrantLock lock
protected final UrlParser urlParser
protected final Options options
protected final LruTraceCache traceCache
protected String username
public boolean hasWarnings
public Results activeStreamingResult
public short serverStatus
protected int autoIncrementIncrement
protected Socket socket
protected PacketOutputStream writer
protected boolean readOnly
protected PacketInputStream reader
protected FailoverProxy proxy
protected volatile boolean connected
protected boolean explicitClosed
protected String database
protected long serverThreadId
protected ServerPrepareStatementCache serverPrepareStatementCache
protected boolean eofDeprecated
protected long serverCapabilities
protected int socketTimeout
protected ExceptionFactory exceptionFactory
protected String serverVersion
protected boolean supportStmtPrepareExecute
public boolean autoCommit
public int transactionIsolationLevel
protected byte[] seed
protected boolean useOceanBaseProtocolV20
protected boolean enableFullLinkTrace
protected boolean useNewExtraInfo
public AbstractConnectProtocol(UrlParser urlParser, GlobalStateInfo globalInfo, ReentrantLock lock, LruTraceCache traceCache)
urlParser - connection URL informationglobalInfo - server global variables informationlock - the lock for thread synchronisationtraceCache - trace cachepublic void close()
public void abort()
public void skip()
throws SQLException
skip in interface ProtocolSQLException - exceptionprotected void cleanMemory()
public void setServerStatus(short serverStatus)
setServerStatus in interface Protocolpublic void removeHasMoreResults()
removeHasMoreResults in interface Protocolpublic void connect()
throws SQLException,
IOException
connect in interface ProtocolSQLException - exceptionIOExceptionpublic void destroySocket()
protected void postConnectionQueries()
throws SQLException
SQLExceptionpublic boolean isClosed()
public boolean checkIfMaster()
throws SQLException
checkIfMaster in interface ProtocolSQLException - if requesting infos for server fail.public void readEofPacket()
throws SQLException,
IOException
readEofPacket in interface ProtocolSQLException - if not a End-of-file packetIOException - if connection error occurpublic void skipEofPacket()
throws SQLException,
IOException
skipEofPacket in interface ProtocolSQLException - if not a End-of-file packetIOException - if connection error occurpublic void setHostFailedWithoutProxy()
setHostFailedWithoutProxy in interface Protocolpublic UrlParser getUrlParser()
getUrlParser in interface Protocolpublic boolean isMasterConnection()
isMasterConnection in interface Protocol@Deprecated public void readPipelineCheckMaster() throws SQLException
SQLExceptionpublic boolean mustBeMasterConnection()
mustBeMasterConnection in interface Protocolpublic boolean noBackslashEscapes()
noBackslashEscapes in interface Protocolpublic void connectWithoutProxy()
throws SQLException
connectWithoutProxy in interface ProtocolSQLException - exceptionpublic boolean shouldReconnectWithoutProxy()
shouldReconnectWithoutProxy in interface Protocolpublic String getServerVersion()
getServerVersion in interface Protocolpublic void setObServerVersion(String version)
setObServerVersion in interface Protocolpublic String getObServerVersion()
getObServerVersion in interface Protocolpublic boolean supportStmtPrepareExecute()
supportStmtPrepareExecute in interface Protocolpublic boolean supportFetchWithOffset()
supportFetchWithOffset in interface Protocolpublic boolean useOceanBaseProtocolV20()
useOceanBaseProtocolV20 in interface Protocolpublic void setFullLinkTraceModule(String module, String action)
setFullLinkTraceModule in interface Protocolpublic String getFullLinkTraceModule()
getFullLinkTraceModule in interface Protocolpublic void setFullLinkTraceAction(String action)
setFullLinkTraceAction in interface Protocolpublic String getFullLinkTraceAction()
getFullLinkTraceAction in interface Protocolpublic void setFullLinkTraceClientInfo(String clientInfo)
setFullLinkTraceClientInfo in interface Protocolpublic String getFullLinkTraceClientInfo()
getFullLinkTraceClientInfo in interface Protocolpublic void setFullLinkTraceIdentifier(String clientIdentifier)
setFullLinkTraceIdentifier in interface Protocolpublic String getFullLinkTraceIdentifier()
getFullLinkTraceIdentifier in interface Protocolpublic byte getFullLinkTraceLevel()
getFullLinkTraceLevel in interface Protocolpublic double getFullLinkTraceSamplePercentage()
getFullLinkTraceSamplePercentage in interface Protocolpublic byte getFullLinkTraceRecordPolicy()
getFullLinkTraceRecordPolicy in interface Protocolpublic double getFullLinkTracePrintSamplePercentage()
getFullLinkTracePrintSamplePercentage in interface Protocolpublic long getFullLinkTraceSlowQueryThreshold()
getFullLinkTraceSlowQueryThreshold in interface Protocolpublic boolean getReadonly()
getReadonly in interface Protocolpublic HostAddress getHostAddress()
getHostAddress in interface Protocolpublic void setHostAddress(HostAddress host)
setHostAddress in interface Protocolpublic FailoverProxy getProxy()
public void setProxy(FailoverProxy proxy)
public String getDatabase()
getDatabase in interface Protocolpublic String getUsername()
getUsername in interface Protocolpublic void parseVersion(String serverVersion)
parseVersion in interface Protocolpublic int getMajorServerVersion()
getMajorServerVersion in interface Protocolpublic int getMinorServerVersion()
getMinorServerVersion in interface Protocolpublic boolean versionGreaterOrEqual(int major,
int minor,
int patch)
versionGreaterOrEqual in interface Protocolmajor - major versionminor - minor versionpatch - patch versionpublic boolean getPinGlobalTxToPhysicalConnection()
getPinGlobalTxToPhysicalConnection in interface Protocolpublic boolean hasWarnings()
hasWarnings in interface Protocolpublic boolean isConnected()
isConnected in interface Protocolpublic long getServerThreadId()
getServerThreadId in interface Protocolpublic boolean isExplicitClosed()
isExplicitClosed in interface Protocolpublic TimeZone getTimeZone()
getTimeZone in interface Protocolpublic TimeZone getServerTimeZone()
public Options getOptions()
getOptions in interface Protocolpublic void setHasWarnings(boolean hasWarnings)
setHasWarnings in interface Protocolpublic Results getActiveStreamingResult()
getActiveStreamingResult in interface Protocolpublic void setActiveStreamingResult(Results activeStreamingResult)
setActiveStreamingResult in interface Protocolpublic void removeActiveStreamingResult()
removeActiveStreamingResult in interface Protocolpublic ReentrantLock getLock()
public boolean hasMoreResults()
hasMoreResults in interface Protocolpublic ServerPrepareStatementCache prepareStatementCache()
prepareStatementCache in interface Protocolpublic abstract void executeQuery(String sql) throws SQLException
executeQuery in interface ProtocolSQLExceptionpublic void changeSocketTcpNoDelay(boolean setTcpNoDelay)
changeSocketTcpNoDelay in interface ProtocolsetTcpNoDelay - value to set.public void changeSocketSoTimeout(int setSoTimeout)
throws SocketException
changeSocketSoTimeout in interface ProtocolSocketExceptionpublic boolean isServerMariaDb()
isServerMariaDb in interface Protocolpublic PacketInputStream getReader()
public boolean isEofDeprecated()
isEofDeprecated in interface Protocolpublic boolean sessionStateAware()
sessionStateAware in interface Protocolpublic String getTraces()
public boolean isOracleMode()
isOracleMode in interface Protocolpublic void setOracleMode(boolean oracleMode)
public boolean isTZTablesImported()
isTZTablesImported in interface Protocolpublic String getEncoding()
getEncoding in interface Protocolpublic PacketOutputStream getWriter()
Copyright © 2022 oceanbase.com. All rights reserved.