
问题就出在druid连接池上,连接池在执行完了某一条错误的sql以后,报错信息会被保存在执行sql的线程中,当下一条拿到这个线程的sql执行时,就直接报错,而不会去执行sql。
最终的解决方法就是解决那条问题线程,肯定是哪里出错才会保留报错信息,或者升级druid的版本。
public DruidPooledConnection getConnectionDirect(long maxWaitMillis) throws SQLException {// 超时重试次数,达到这个值就报错
int notFullTimeoutRetryCnt = 0
for () {
// handle notFullTimeoutRetry
DruidPooledConnection poolableConnection
try {
// 核心逻辑
poolableConnection = getConnectionInternal(maxWaitMillis)
} catch (GetConnectionTimeoutException ex) {
if (notFullTimeoutRetryCnt <= this.notFullTimeoutRetryCount &&!isFull()) {
notFullTimeoutRetryCnt++
if (LOG.isWarnEnabled()) {
LOG.warn("get connection timeout retry : " + notFullTimeoutRetryCnt)
}
continue
}
throw ex
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)