mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
implement javax.sql.ConnectionPoolDataSource
This commit is contained in:
@@ -345,5 +345,13 @@
|
||||
<version>1.3.167</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>4.1.4.Final</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -36,6 +36,8 @@ import javax.naming.Referenceable;
|
||||
import javax.naming.StringRefAddr;
|
||||
import javax.sql.ConnectionEvent;
|
||||
import javax.sql.ConnectionEventListener;
|
||||
import javax.sql.ConnectionPoolDataSource;
|
||||
import javax.sql.PooledConnection;
|
||||
|
||||
import com.alibaba.druid.TransactionTimeoutException;
|
||||
import com.alibaba.druid.VERSION;
|
||||
@@ -65,7 +67,7 @@ import com.alibaba.druid.util.JdbcUtils;
|
||||
* @author ljw<ljw2083@alibaba-inc.com>
|
||||
* @author wenshao<szujobs@hotmail.com>
|
||||
*/
|
||||
public class DruidDataSource extends DruidAbstractDataSource implements DruidDataSourceMBean, ManagedDataSource, Referenceable, Closeable, Cloneable {
|
||||
public class DruidDataSource extends DruidAbstractDataSource implements DruidDataSourceMBean, ManagedDataSource, Referenceable, Closeable, Cloneable, ConnectionPoolDataSource {
|
||||
|
||||
private final static Log LOG = LogFactory.getLog(DruidDataSource.class);
|
||||
|
||||
@@ -404,6 +406,16 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
return getConnectionDirect(maxWaitMillis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PooledConnection getPooledConnection() throws SQLException {
|
||||
return getConnection(maxWait);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PooledConnection getPooledConnection(String user, String password) throws SQLException {
|
||||
throw new UnsupportedOperationException("Not supported by DruidDataSource");
|
||||
}
|
||||
|
||||
public DruidPooledConnection getConnectionDirect(long maxWaitMillis) throws SQLException {
|
||||
final int maxWaitThreadCount = getMaxWaitThreadCount();
|
||||
@@ -1404,4 +1416,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user