add more error info.

This commit is contained in:
shaojin.wensj
2018-11-23 17:32:50 +08:00
parent 475a848d6f
commit 4ffa0525c4
2 changed files with 23 additions and 8 deletions
@@ -316,6 +316,17 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
}
}
}
{
String property = properties.getProperty("druid.maxWait");
if (property != null && property.length() > 0) {
try {
int value = Integer.parseInt(property);
this.setMaxWait(value);
} catch (NumberFormatException e) {
LOG.error("illegal property 'druid.maxWait'", e);
}
}
}
{
Boolean value = getBoolean(properties, "druid.failFast");
if (value != null) {
@@ -1519,6 +1530,10 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
}
}
if (createErrorCount > 0) {
buf.append(", createErrorCount ").append(createErrorCount);
}
List<JdbcSqlStatValue> sqlList = this.getDataSourceStat().getRuningSqlList();
for (int i = 0; i < sqlList.size(); ++i) {
if (i != 0) {
@@ -1150,14 +1150,6 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
}
private void checkStateInternal() throws SQLException {
if (holder == null) {
if (disableError != null) {
throw new SQLException("connection holder is null", disableError);
} else {
throw new SQLException("connection holder is null");
}
}
if (closed) {
if (disableError != null) {
throw new SQLException("connection closed", disableError);
@@ -1173,6 +1165,14 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
throw new SQLException("connection disabled");
}
}
if (holder == null) {
if (disableError != null) {
throw new SQLException("connection holder is null", disableError);
} else {
throw new SQLException("connection holder is null");
}
}
}
public String toString() {