HDDataSource

This commit is contained in:
wenshao
2011-12-03 06:23:00 +08:00
parent d7ee8d45be
commit a910816eff
12 changed files with 284 additions and 22 deletions
@@ -329,9 +329,13 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
lock.unlock();
}
}
@Override
public Connection getConnection() throws SQLException {
return getConnection(maxWait);
}
public Connection getConnection(long maxWaitMillis) throws SQLException {
init();
final int maxWaitThreadCount = getMaxWaitThreadCount();
@@ -349,7 +353,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
}
for (;;) {
PoolableConnection poolalbeConnection = getConnectionInternal();
PoolableConnection poolalbeConnection = getConnectionInternal(maxWaitMillis);
if (isTestOnBorrow()) {
boolean validate = testConnectionInternal(poolalbeConnection.getConnection());
@@ -423,7 +427,7 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
}
}
private PoolableConnection getConnectionInternal() throws SQLException {
private PoolableConnection getConnectionInternal(long maxWait) throws SQLException {
PoolableConnection poolalbeConnection;
try {