Browse Source

Pull request #1118: BI-74885 fix: clickhouse数据连接出错时一直尝试连接

Merge in CORE/base-third from ~ROGER.CHEN/base-third:release/10.0 to release/10.0

* commit '24d0d82701eb183460fd48092b1c504471dcfb97':
  BI-74885 fix: clickhouse数据连接出错时一直尝试连接
  BI-74885 fix: clickhouse数据连接出错时一直尝试连接
  BI-74885 fix: clickhouse数据连接出错时一直尝试连接
release/10.0
Roger.Chen 4 years ago
parent
commit
1d3a1ab7f4
  1. 15
      fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java

15
fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java

@ -2164,10 +2164,13 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
try {
connection = createPhysicalConnection();
setFailContinuous(false);
} catch (SQLException e) {
LOG.error("create connection error, url: " + jdbcUrl + ", errorCode " + e.getErrorCode()
+ ", state " + e.getSQLState(), e);
} catch (SQLException | RuntimeException e) {
if (e instanceof SQLException) {
LOG.error("create connection error, url: " + jdbcUrl + ", errorCode " + ((SQLException)e).getErrorCode()
+ ", state " + ((SQLException)e).getSQLState(), e);
} else {
LOG.error("create connection error", e);
}
errorCount++;
if (errorCount > connectionErrorRetryAttempts && timeBetweenConnectErrorMillis > 0) {
// fail over retry attempts
@ -2193,10 +2196,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
DruidDataSource.this.doSomethingBeforeCreationThreadBreak();
break;
}
} catch (RuntimeException e) {
LOG.error("create connection error", e);
setFailContinuous(true);
continue;
} catch (Error e) {
LOG.error("create connection error", e);
setFailContinuous(true);

Loading…
Cancel
Save