improve error info

This commit is contained in:
wenshao
2013-07-04 15:41:43 +08:00
parent dcda68116d
commit e2b36b7180
2 changed files with 11 additions and 11 deletions
@@ -1317,10 +1317,13 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
empty.signal(); // send signal to CreateThread create connection
if (estimate <= 0) {
String errorMessage = "loopWaitCount " + i + ", wait millis " + (nanos - estimate) / (1000 * 1000)
+ ", active " + activeCount;
if (this.createError == null) {
throw new GetConnectionTimeoutException(createError);
throw new GetConnectionTimeoutException(errorMessage, createError);
} else {
throw new GetConnectionTimeoutException();
throw new GetConnectionTimeoutException(errorMessage);
}
}
@@ -1354,11 +1357,12 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
continue;
}
String errorMessage = "loopWaitCount " + i + ", wait millis " + (nanos - estimate) / (1000 * 1000)
+ ", active " + activeCount;
if (createError != null) {
throw new GetConnectionTimeoutException(createError);
throw new GetConnectionTimeoutException(errorMessage, createError);
} else {
throw new GetConnectionTimeoutException("loopWaitCount " + i + ", wait millis "
+ (nanos - estimate) / (1000 * 1000));
throw new GetConnectionTimeoutException(errorMessage);
}
}
}
@@ -20,17 +20,13 @@ import java.sql.SQLException;
public class GetConnectionTimeoutException extends SQLException {
private static final long serialVersionUID = 1L;
public GetConnectionTimeoutException(){
super();
}
public GetConnectionTimeoutException(String reason){
super(reason);
}
public GetConnectionTimeoutException(Throwable cause){
super(cause);
public GetConnectionTimeoutException(String mesage, Throwable cause){
super(mesage, cause);
}
}