Class AbstractQueryProtocol
- java.lang.Object
-
- org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
-
- org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol
-
- All Implemented Interfaces:
Protocol
- Direct Known Subclasses:
MasterProtocol
public class AbstractQueryProtocol extends AbstractConnectProtocol implements Protocol
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.FutureTaskactiveFutureTaskprivate booleaninterruptedprivate java.io.InputStreamlocalInfileInputStreamprivate static java.util.Set<java.lang.Integer>LOCK_DEADLOCK_ERROR_CODESprivate static Loggerloggerprivate longmaxRowsprivate java.util.concurrent.ThreadPoolExecutorreadSchedulerprivate intstatementIdToReleaseprivate inttransactionIsolationLevel-
Fields inherited from class org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
activeStreamingResult, autoIncrementIncrement, CHECK_GALERA_STATE_QUERY, connected, database, eofDeprecated, exceptionFactory, explicitClosed, galeraAllowedStates, hasWarnings, lock, options, proxy, reader, readOnly, serverCapabilities, serverPrepareStatementCache, serverStatus, serverThreadId, socket, socketTimeout, traceCache, urlParser, writer
-
-
Constructor Summary
Constructors Constructor Description AbstractQueryProtocol(UrlParser urlParser, GlobalStateInfo globalInfo, java.util.concurrent.locks.ReentrantLock lock, LruTraceCache traceCache)Get a protocol instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelCurrentQuery()Cancels the current query - clones the current protocol and executes a query using the new connection.private voidcheckClose()voidcloseExplicit()private voidcmdPrologue()private MariaDbSqlExceptionexceptionWithQuery(java.lang.String sql, java.sql.SQLException sqlException, boolean explicitClosed)private MariaDbSqlExceptionexceptionWithQuery(ParameterHolder[] parameters, PrepareResult serverPrepareResult, java.sql.SQLException sqlException, boolean explicitClosed)private voidexecuteBatch(Results results, java.util.List<java.lang.String> queries)Execute list of queries not rewritable.private voidexecuteBatchAggregateSemiColon(Results results, java.util.List<java.lang.String> queries)Execute list of queries.booleanexecuteBatchClient(boolean mustExecuteOnMaster, Results results, ClientPrepareResult prepareResult, java.util.List<ParameterHolder[]> parametersList)Execute clientPrepareQuery batch.private voidexecuteBatchMulti(Results results, ClientPrepareResult clientPrepareResult, java.util.List<ParameterHolder[]> parametersList)Execute clientPrepareQuery batch.private voidexecuteBatchRewrite(Results results, ClientPrepareResult prepareResult, java.util.List<ParameterHolder[]> parameterList, boolean rewriteValues)Specific execution for batch rewrite that has specific query for memory.booleanexecuteBatchServer(boolean mustExecuteOnMaster, ServerPrepareResult serverPrepareResult, Results results, java.lang.String sql, java.util.List<ParameterHolder[]> parametersList)Execute Prepare if needed, and execute COM_STMT_EXECUTE queries in batch.voidexecuteBatchStmt(boolean mustExecuteOnMaster, Results results, java.util.List<java.lang.String> queries)Execute batch from Statement.executeBatch().private booleanexecuteBulkBatch(Results results, java.lang.String sql, ServerPrepareResult serverPrepareResult, java.util.List<ParameterHolder[]> parametersList)Execute clientPrepareQuery batch.voidexecutePreparedQuery(boolean mustExecuteOnMaster, ServerPrepareResult serverPrepareResult, Results results, ParameterHolder[] parameters)Execute a query that is already prepared.voidexecuteQuery(boolean mustExecuteOnMaster, Results results, java.lang.String sql)Execute query directly to outputStream.voidexecuteQuery(boolean mustExecuteOnMaster, Results results, java.lang.String sql, java.nio.charset.Charset charset)voidexecuteQuery(boolean mustExecuteOnMaster, Results results, ClientPrepareResult clientPrepareResult, ParameterHolder[] parameters)Execute a unique clientPrepareQuery.voidexecuteQuery(boolean mustExecuteOnMaster, Results results, ClientPrepareResult clientPrepareResult, ParameterHolder[] parameters, int queryTimeout)Execute a unique clientPrepareQuery.voidexecuteQuery(java.lang.String sql)Execute internal query.booleanforceReleasePrepareStatement(int statementId)Force release of prepare statement that are not used.voidforceReleaseWaitingPrepareStatement()Force release of prepare statement that are not used.booleangetAutocommit()Get current autocommit status.intgetAutoIncrementIncrement()Get current auto increment increment.java.lang.StringgetCatalog()longgetMaxRows()voidgetResult(Results results)intgetTimeout()Returns the connection timeout in milliseconds.intgetTransactionIsolationLevel()java.sql.SQLExceptionhandleIoException(java.lang.Exception initialException)Handle IoException (reconnect if Exception is due to having send too much data, making server close the connection.private voidhandleStateChange(Buffer buf, Results results)private voidinitializeBatchReader()voidinterrupt()booleaninTransaction()booleanisInterrupted()booleanisValid(int timeout)Check that connection is valid.booleanping()ServerPrepareResultprepare(java.lang.String sql, boolean executeOnMaster)Prepare query on server side.voidprolog(long maxRows, boolean hasProxy, MariaDbConnection connection, MariaDbStatement statement)Preparation before command.voidprologProxy(ServerPrepareResult serverPrepareResult, long maxRows, boolean hasProxy, MariaDbConnection connection, MariaDbStatement statement)ServerPrepareResultputInCache(java.lang.String key, ServerPrepareResult serverPrepareResult)private java.sql.SQLExceptionreadErrorPacket(Buffer buffer, Results results)Read ERR_Packet.private voidreadLocalInfilePacket(Buffer buffer, Results results)Read Local_infile Packet.private voidreadOkPacket(Buffer buffer, Results results)Read OK_Packet.private voidreadPacket(Results results)Read server response packet.private voidreadResultSet(Buffer buffer, Results results)Read ResultSet Packet.voidreleasePrepareStatement(ServerPrepareResult serverPrepareResult)Deallocate prepare statement if not used anymore.voidreset()Reset connection state.voidresetDatabase()voidresetStateAfterFailover(long maxRows, int transactionIsolationLevel, java.lang.String database, boolean autocommit)Set current state after a failover.voidrollback()Rollback transaction.voidsetActiveFutureTask(java.util.concurrent.FutureTask activeFutureTask)voidsetCatalog(java.lang.String database)voidsetLocalInfileInputStream(java.io.InputStream inputStream)voidsetMaxRows(long max)voidsetReadonly(boolean readOnly)Puts this connection in read-only / read-write modevoidsetTimeout(int timeout)Sets the connection timeout.voidsetTransactionIsolation(int level)Set transaction isolation.voidstopIfInterrupted()Throw TimeoutException if timeout has been reached.-
Methods inherited from class org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol
abort, changeSocketSoTimeout, changeSocketTcpNoDelay, checkIfMaster, close, connect, connectWithoutProxy, destroySocket, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getTimeZone, getTraces, getUrlParser, getUsername, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isMasterConnection, isServerMariaDb, mustBeMasterConnection, noBackslashEscapes, prepareStatementCache, readEofPacket, readPipelineCheckMaster, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mariadb.jdbc.internal.protocol.Protocol
abort, changeSocketSoTimeout, changeSocketTcpNoDelay, checkIfMaster, close, connect, connectWithoutProxy, getActiveStreamingResult, getDatabase, getHost, getHostAddress, getLock, getMajorServerVersion, getMinorServerVersion, getOptions, getPinGlobalTxToPhysicalConnection, getPort, getProxy, getReader, getReadonly, getServerThreadId, getServerVersion, getSocket, getTimeZone, getTraces, getUrlParser, getUsername, hasMoreResults, hasWarnings, isClosed, isConnected, isEofDeprecated, isExplicitClosed, isMasterConnection, isServerMariaDb, mustBeMasterConnection, noBackslashEscapes, prepareStatementCache, readEofPacket, removeActiveStreamingResult, removeHasMoreResults, sessionStateAware, setActiveStreamingResult, setHasWarnings, setHostAddress, setHostFailedWithoutProxy, setProxy, setServerStatus, shouldReconnectWithoutProxy, skip, skipEofPacket, versionGreaterOrEqual
-
-
-
-
Field Detail
-
logger
private static final Logger logger
-
LOCK_DEADLOCK_ERROR_CODES
private static final java.util.Set<java.lang.Integer> LOCK_DEADLOCK_ERROR_CODES
-
readScheduler
private java.util.concurrent.ThreadPoolExecutor readScheduler
-
transactionIsolationLevel
private int transactionIsolationLevel
-
localInfileInputStream
private java.io.InputStream localInfileInputStream
-
maxRows
private long maxRows
-
statementIdToRelease
private volatile int statementIdToRelease
-
activeFutureTask
private java.util.concurrent.FutureTask activeFutureTask
-
interrupted
private boolean interrupted
-
-
Constructor Detail
-
AbstractQueryProtocol
AbstractQueryProtocol(UrlParser urlParser, GlobalStateInfo globalInfo, java.util.concurrent.locks.ReentrantLock lock, LruTraceCache traceCache)
Get a protocol instance.- Parameters:
urlParser- connection URL information'slock- the lock for thread synchronisationtraceCache- trace cache
-
-
Method Detail
-
reset
public void reset() throws java.sql.SQLExceptionReset connection state.- Transaction will be rollback
- transaction isolation will be reset
- user variables will be removed
- sessions variables will be reset to global values
-
exceptionWithQuery
private MariaDbSqlException exceptionWithQuery(ParameterHolder[] parameters, PrepareResult serverPrepareResult, java.sql.SQLException sqlException, boolean explicitClosed)
-
exceptionWithQuery
private MariaDbSqlException exceptionWithQuery(java.lang.String sql, java.sql.SQLException sqlException, boolean explicitClosed)
-
executeQuery
public void executeQuery(java.lang.String sql) throws java.sql.SQLExceptionExecute internal query.!! will not support multi values queries !!
- Specified by:
executeQueryin interfaceProtocol- Specified by:
executeQueryin classAbstractConnectProtocol- Parameters:
sql- sql- Throws:
java.sql.SQLException- in any exception occur
-
executeQuery
public void executeQuery(boolean mustExecuteOnMaster, Results results, java.lang.String sql) throws java.sql.SQLExceptionExecute query directly to outputStream.- Specified by:
executeQueryin interfaceProtocol- Parameters:
mustExecuteOnMaster- was intended to be launched on master connectionresults- resultsql- the query to executeInternal- Throws:
java.sql.SQLException- exception
-
executeQuery
public void executeQuery(boolean mustExecuteOnMaster, Results results, java.lang.String sql, java.nio.charset.Charset charset) throws java.sql.SQLException- Specified by:
executeQueryin interfaceProtocol- Throws:
java.sql.SQLException
-
executeQuery
public void executeQuery(boolean mustExecuteOnMaster, Results results, ClientPrepareResult clientPrepareResult, ParameterHolder[] parameters) throws java.sql.SQLExceptionExecute a unique clientPrepareQuery.- Specified by:
executeQueryin interfaceProtocol- Parameters:
mustExecuteOnMaster- was intended to be launched on master connectionresults- resultsclientPrepareResult- clientPrepareResultparameters- parameters- Throws:
java.sql.SQLException- exception
-
executeQuery
public void executeQuery(boolean mustExecuteOnMaster, Results results, ClientPrepareResult clientPrepareResult, ParameterHolder[] parameters, int queryTimeout) throws java.sql.SQLExceptionExecute a unique clientPrepareQuery.- Specified by:
executeQueryin interfaceProtocol- Parameters:
mustExecuteOnMaster- was intended to be launched on master connectionresults- resultsclientPrepareResult- clientPrepareResultparameters- parametersqueryTimeout- if timeout is set and must use max_statement_time- Throws:
java.sql.SQLException- exception
-
executeBatchClient
public boolean executeBatchClient(boolean mustExecuteOnMaster, Results results, ClientPrepareResult prepareResult, java.util.List<ParameterHolder[]> parametersList) throws java.sql.SQLExceptionExecute clientPrepareQuery batch.- Specified by:
executeBatchClientin interfaceProtocol- Parameters:
mustExecuteOnMaster- was intended to be launched on master connectionresults- resultsprepareResult- ClientPrepareResultparametersList- List of parameters- Throws:
java.sql.SQLException- exception
-
executeBulkBatch
private boolean executeBulkBatch(Results results, java.lang.String sql, ServerPrepareResult serverPrepareResult, java.util.List<ParameterHolder[]> parametersList) throws java.sql.SQLException
Execute clientPrepareQuery batch.- Parameters:
results- resultssql- sql commandserverPrepareResult- prepare result if existparametersList- List of parameters- Returns:
- if executed
- Throws:
java.sql.SQLException- exception
-
initializeBatchReader
private void initializeBatchReader()
-
executeBatchMulti
private void executeBatchMulti(Results results, ClientPrepareResult clientPrepareResult, java.util.List<ParameterHolder[]> parametersList) throws java.sql.SQLException
Execute clientPrepareQuery batch.- Parameters:
results- resultsclientPrepareResult- ClientPrepareResultparametersList- List of parameters- Throws:
java.sql.SQLException- exception
-
executeBatchStmt
public void executeBatchStmt(boolean mustExecuteOnMaster, Results results, java.util.List<java.lang.String> queries) throws java.sql.SQLExceptionExecute batch from Statement.executeBatch().- Specified by:
executeBatchStmtin interfaceProtocol- Parameters:
mustExecuteOnMaster- was intended to be launched on master connectionresults- resultsqueries- queries- Throws:
java.sql.SQLException- if any exception occur
-
executeBatch
private void executeBatch(Results results, java.util.List<java.lang.String> queries) throws java.sql.SQLException
Execute list of queries not rewritable.- Parameters:
results- result objectqueries- list of queries- Throws:
java.sql.SQLException- exception
-
prepare
public ServerPrepareResult prepare(java.lang.String sql, boolean executeOnMaster) throws java.sql.SQLException
Prepare query on server side. Will permit to know the parameter number of the query, and permit to send only the data on next results.For failover, two additional information are in the result-set object : - current connection : Since server maintain a state of this prepare statement, all query will be executed on this particular connection. - executeOnMaster : state of current connection when creating this prepareStatement (if was on master, will only be executed on master. If was on a replica, can be execute temporary on master, but we keep this flag, so when a replica is connected back to relaunch this query on replica)
-
executeBatchAggregateSemiColon
private void executeBatchAggregateSemiColon(Results results, java.util.List<java.lang.String> queries) throws java.sql.SQLException
Execute list of queries. This method is used when using text batch statement and using rewriting (allowMultiQueries || rewriteBatchedStatements). queries will be send to server according to max_allowed_packet size.- Parameters:
results- result objectqueries- list of queries- Throws:
java.sql.SQLException- exception
-
executeBatchRewrite
private void executeBatchRewrite(Results results, ClientPrepareResult prepareResult, java.util.List<ParameterHolder[]> parameterList, boolean rewriteValues) throws java.sql.SQLException
Specific execution for batch rewrite that has specific query for memory.- Parameters:
results- resultprepareResult- prepareResultparameterList- parametersrewriteValues- is rewritable flag- Throws:
java.sql.SQLException- exception
-
executeBatchServer
public boolean executeBatchServer(boolean mustExecuteOnMaster, ServerPrepareResult serverPrepareResult, Results results, java.lang.String sql, java.util.List<ParameterHolder[]> parametersList) throws java.sql.SQLExceptionExecute Prepare if needed, and execute COM_STMT_EXECUTE queries in batch.- Specified by:
executeBatchServerin interfaceProtocol- Parameters:
mustExecuteOnMaster- must normally be executed on master connectionserverPrepareResult- prepare result. can be null if not prepared.results- execution resultssql- sql query if needed to be preparedparametersList- parameter list- Returns:
- executed
- Throws:
java.sql.SQLException- if parameter error or connection error occur.
-
executePreparedQuery
public void executePreparedQuery(boolean mustExecuteOnMaster, ServerPrepareResult serverPrepareResult, Results results, ParameterHolder[] parameters) throws java.sql.SQLExceptionExecute a query that is already prepared.- Specified by:
executePreparedQueryin interfaceProtocol- Parameters:
mustExecuteOnMaster- must execute on masterserverPrepareResult- prepare resultresults- execution resultparameters- parameters- Throws:
java.sql.SQLException- exception
-
rollback
public void rollback() throws java.sql.SQLExceptionRollback transaction.
-
forceReleasePrepareStatement
public boolean forceReleasePrepareStatement(int statementId) throws java.sql.SQLExceptionForce release of prepare statement that are not used. This method will be call when adding a new prepare statement in cache, so the packet can be send to server without problem.- Specified by:
forceReleasePrepareStatementin interfaceProtocol- Parameters:
statementId- prepared statement Id to remove.- Returns:
- true if successfully released
- Throws:
java.sql.SQLException- if connection exception.
-
forceReleaseWaitingPrepareStatement
public void forceReleaseWaitingPrepareStatement() throws java.sql.SQLExceptionForce release of prepare statement that are not used. This permit to deallocate a statement that cannot be release due to multi-thread use.- Specified by:
forceReleaseWaitingPrepareStatementin interfaceProtocol- Throws:
java.sql.SQLException- if connection occur
-
ping
public boolean ping() throws java.sql.SQLException
-
isValid
public boolean isValid(int timeout) throws java.sql.SQLExceptionCheck that connection is valid. !! careful, timeout is in milliseconds, connection.isValid(timeout) is in seconds !!
-
getCatalog
public java.lang.String getCatalog() throws java.sql.SQLException- Specified by:
getCatalogin interfaceProtocol- Throws:
java.sql.SQLException
-
setCatalog
public void setCatalog(java.lang.String database) throws java.sql.SQLException- Specified by:
setCatalogin interfaceProtocol- Throws:
java.sql.SQLException
-
resetDatabase
public void resetDatabase() throws java.sql.SQLException- Specified by:
resetDatabasein interfaceProtocol- Throws:
java.sql.SQLException
-
cancelCurrentQuery
public void cancelCurrentQuery() throws java.sql.SQLExceptionCancels the current query - clones the current protocol and executes a query using the new connection.- Specified by:
cancelCurrentQueryin interfaceProtocol- Throws:
java.sql.SQLException- never thrown
-
getAutocommit
public boolean getAutocommit()
Get current autocommit status.- Specified by:
getAutocommitin interfaceProtocol- Returns:
- autocommit status
-
inTransaction
public boolean inTransaction()
- Specified by:
inTransactionin interfaceProtocol
-
closeExplicit
public void closeExplicit()
- Specified by:
closeExplicitin interfaceProtocol
-
releasePrepareStatement
public void releasePrepareStatement(ServerPrepareResult serverPrepareResult) throws java.sql.SQLException
Deallocate prepare statement if not used anymore.- Specified by:
releasePrepareStatementin interfaceProtocol- Parameters:
serverPrepareResult- allocation result- Throws:
java.sql.SQLException- if de-allocation failed.
-
getMaxRows
public long getMaxRows()
- Specified by:
getMaxRowsin interfaceProtocol
-
setMaxRows
public void setMaxRows(long max) throws java.sql.SQLException- Specified by:
setMaxRowsin interfaceProtocol- Throws:
java.sql.SQLException
-
setLocalInfileInputStream
public void setLocalInfileInputStream(java.io.InputStream inputStream)
- Specified by:
setLocalInfileInputStreamin interfaceProtocol
-
getTimeout
public int getTimeout()
Returns the connection timeout in milliseconds.- Specified by:
getTimeoutin interfaceProtocol- Returns:
- the connection timeout in milliseconds.
-
setTimeout
public void setTimeout(int timeout) throws java.net.SocketExceptionSets the connection timeout.- Specified by:
setTimeoutin interfaceProtocol- Parameters:
timeout- the timeout, in milliseconds- Throws:
java.net.SocketException- if there is an error in the underlying protocol, such as a TCP error.
-
setReadonly
public void setReadonly(boolean readOnly) throws java.sql.SQLExceptionPuts this connection in read-only / read-write mode- Specified by:
setReadonlyin interfaceProtocol- Parameters:
readOnly- true enables read-only mode; false disables it- Throws:
java.sql.SQLException- If socket error.
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws java.sql.SQLExceptionSet transaction isolation.- Specified by:
setTransactionIsolationin interfaceProtocol- Parameters:
level- transaction level.- Throws:
java.sql.SQLException- if transaction level is unknown
-
getTransactionIsolationLevel
public int getTransactionIsolationLevel()
- Specified by:
getTransactionIsolationLevelin interfaceProtocol
-
checkClose
private void checkClose() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getResult
public void getResult(Results results) throws java.sql.SQLException
-
readPacket
private void readPacket(Results results) throws java.sql.SQLException
Read server response packet.- Parameters:
results- result object- Throws:
java.sql.SQLException- if sub-result connection fail- See Also:
- server response packets
-
readOkPacket
private void readOkPacket(Buffer buffer, Results results)
Read OK_Packet.- Parameters:
buffer- current bufferresults- result object- See Also:
- OK_Packet
-
getAutoIncrementIncrement
public int getAutoIncrementIncrement() throws java.sql.SQLExceptionGet current auto increment increment. *** no lock needed ****- Specified by:
getAutoIncrementIncrementin interfaceProtocol- Returns:
- auto increment increment.
- Throws:
java.sql.SQLException- if cannot retrieve auto increment value
-
readErrorPacket
private java.sql.SQLException readErrorPacket(Buffer buffer, Results results)
Read ERR_Packet.- Parameters:
buffer- current bufferresults- result object- Returns:
- SQLException if sub-result connection fail
- See Also:
- ERR_Packet
-
readLocalInfilePacket
private void readLocalInfilePacket(Buffer buffer, Results results) throws java.sql.SQLException
Read Local_infile Packet.- Parameters:
buffer- current bufferresults- result object- Throws:
java.sql.SQLException- if sub-result connection fail- See Also:
- local_infile packet
-
readResultSet
private void readResultSet(Buffer buffer, Results results) throws java.sql.SQLException
Read ResultSet Packet.- Parameters:
buffer- current bufferresults- result object- Throws:
java.sql.SQLException- if sub-result connection fail- See Also:
- resultSet packets
-
prologProxy
public void prologProxy(ServerPrepareResult serverPrepareResult, long maxRows, boolean hasProxy, MariaDbConnection connection, MariaDbStatement statement) throws java.sql.SQLException
- Specified by:
prologProxyin interfaceProtocol- Throws:
java.sql.SQLException
-
prolog
public void prolog(long maxRows, boolean hasProxy, MariaDbConnection connection, MariaDbStatement statement) throws java.sql.SQLExceptionPreparation before command.
-
putInCache
public ServerPrepareResult putInCache(java.lang.String key, ServerPrepareResult serverPrepareResult)
- Specified by:
putInCachein interfaceProtocol
-
cmdPrologue
private void cmdPrologue() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
resetStateAfterFailover
public void resetStateAfterFailover(long maxRows, int transactionIsolationLevel, java.lang.String database, boolean autocommit) throws java.sql.SQLExceptionSet current state after a failover.- Specified by:
resetStateAfterFailoverin interfaceProtocol- Parameters:
maxRows- current Max rowstransactionIsolationLevel- current transactionIsolationLeveldatabase- current databaseautocommit- current autocommit state- Throws:
java.sql.SQLException- if any error occur.
-
handleIoException
public java.sql.SQLException handleIoException(java.lang.Exception initialException)
Handle IoException (reconnect if Exception is due to having send too much data, making server close the connection.There is 3 kind of IOException :
- MaxAllowedPacketException : without need of reconnect : thrown when driver don't send packet that would have been too big then error is not a CONNECTION_EXCEPTION
- packets size is greater than max_allowed_packet (can be checked with writer.isAllowedCmdLength()). Need to reconnect
- unknown IO error throw a CONNECTION_EXCEPTION
- Specified by:
handleIoExceptionin interfaceProtocol- Parameters:
initialException- initial Io error- Returns:
- the resulting error to return to client.
-
setActiveFutureTask
public void setActiveFutureTask(java.util.concurrent.FutureTask activeFutureTask)
- Specified by:
setActiveFutureTaskin interfaceProtocol
-
isInterrupted
public boolean isInterrupted()
- Specified by:
isInterruptedin interfaceProtocol
-
stopIfInterrupted
public void stopIfInterrupted() throws java.sql.SQLTimeoutExceptionThrow TimeoutException if timeout has been reached.- Specified by:
stopIfInterruptedin interfaceProtocol- Throws:
java.sql.SQLTimeoutException- to indicate timeout exception.
-
-