mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
recover fatal error
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.1.20_preview_07</version>
|
||||
<version>1.1.20_preview_08</version>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
<name>druid</name>
|
||||
|
||||
@@ -1691,6 +1691,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
public void handleConnectionException(DruidPooledConnection pooledConnection, Throwable t, String sql) throws SQLException {
|
||||
final DruidConnectionHolder holder = pooledConnection.getConnectionHolder();
|
||||
if (holder == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
errorCountUpdater.incrementAndGet(this);
|
||||
lastError = t;
|
||||
@@ -2998,7 +3001,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
DruidConnectionHolder connection = connections[i];
|
||||
|
||||
if (onFatalError || fatalErrorIncrement > 0) {
|
||||
if (lastFatalErrorTimeMillis < connection.lastActiveTimeMillis) {
|
||||
if (lastFatalErrorTimeMillis > connection.lastActiveTimeMillis) {
|
||||
keepAliveConnections[keepAliveCount++] = connection;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
@@ -147,6 +147,7 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
public void closePoolableStatement(DruidPooledPreparedStatement stmt) throws SQLException {
|
||||
PreparedStatement rawStatement = stmt.getRawPreparedStatement();
|
||||
|
||||
final DruidConnectionHolder holder = this.holder;
|
||||
if (holder == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,8 +98,9 @@ public class DruidPooledStatement extends PoolableWrapper implements Statement {
|
||||
|
||||
DruidDataSource dataSource = null;
|
||||
|
||||
if (this.conn.holder.dataSource instanceof DruidDataSource) {
|
||||
dataSource = (DruidDataSource) this.conn.holder.dataSource;
|
||||
final DruidConnectionHolder holder = this.conn.holder;
|
||||
if (holder.dataSource instanceof DruidDataSource) {
|
||||
dataSource = (DruidDataSource) holder.dataSource;
|
||||
}
|
||||
if (dataSource == null) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user