mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
C3P0兼容
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@666 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -113,6 +113,7 @@ public abstract class DruidAbstractDataSource implements DruidAbstractDataSource
|
||||
private boolean testOnReturn = DEFAULT_TEST_ON_RETURN;
|
||||
private boolean testWhileIdle = DEFAULT_WHILE_IDLE;
|
||||
protected boolean poolPreparedStatements = false;
|
||||
protected int maxPoolPreparedStatementPerConnectionSize = -1;
|
||||
|
||||
protected boolean inited = false;
|
||||
|
||||
@@ -163,12 +164,20 @@ public abstract class DruidAbstractDataSource implements DruidAbstractDataSource
|
||||
|
||||
protected long id;
|
||||
|
||||
protected Date createdTime;
|
||||
protected Date createdTime;
|
||||
|
||||
public long getDupCloseCount() {
|
||||
return dupCloseCount.get();
|
||||
}
|
||||
|
||||
public int getMaxPoolPreparedStatementPerConnectionSize() {
|
||||
return maxPoolPreparedStatementPerConnectionSize;
|
||||
}
|
||||
|
||||
public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) {
|
||||
this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize;
|
||||
}
|
||||
|
||||
public void incrementDupCloseCount() {
|
||||
dupCloseCount.incrementAndGet();
|
||||
}
|
||||
@@ -869,7 +878,8 @@ public abstract class DruidAbstractDataSource implements DruidAbstractDataSource
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void handleConnectionException(PoolableConnection pooledConnection, Throwable t) throws SQLException;
|
||||
public abstract void handleConnectionException(PoolableConnection pooledConnection, Throwable t)
|
||||
throws SQLException;
|
||||
|
||||
protected abstract void recycle(PoolableConnection pooledConnection) throws SQLException;
|
||||
|
||||
@@ -1253,14 +1263,14 @@ public abstract class DruidAbstractDataSource implements DruidAbstractDataSource
|
||||
public long getID() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
|
||||
public abstract int getRawDriverMajorVersion();
|
||||
|
||||
|
||||
public abstract int getRawDriverMinorVersion();
|
||||
|
||||
|
||||
public abstract String getProperties();
|
||||
}
|
||||
|
||||
@@ -216,6 +216,14 @@ public class DruidDataSourceC3P0Adapter implements DataSource, DruidDataSourceC3
|
||||
return getNumBusyConnections();
|
||||
}
|
||||
|
||||
public int getMaxStatementsPerConnection() {
|
||||
return dataSource.getMaxPoolPreparedStatementPerConnectionSize();
|
||||
}
|
||||
|
||||
public void setMaxStatementsPerConnection(int maxStatementsPerConnection) {
|
||||
dataSource.setMaxPoolPreparedStatementPerConnectionSize(maxStatementsPerConnection);
|
||||
}
|
||||
|
||||
// /////////////////
|
||||
|
||||
@Override
|
||||
@@ -245,7 +253,6 @@ public class DruidDataSourceC3P0Adapter implements DataSource, DruidDataSourceC3
|
||||
|
||||
// ///////////////
|
||||
|
||||
private int maxStatementsPerConnection;
|
||||
private String overrideDefaultUser;
|
||||
private String overrideDefaultPassword;
|
||||
private int propertyCycle;
|
||||
@@ -275,14 +282,6 @@ public class DruidDataSourceC3P0Adapter implements DataSource, DruidDataSourceC3
|
||||
this.maxStatements = maxStatements;
|
||||
}
|
||||
|
||||
public int getMaxStatementsPerConnection() {
|
||||
return maxStatementsPerConnection;
|
||||
}
|
||||
|
||||
public void setMaxStatementsPerConnection(int maxStatementsPerConnection) {
|
||||
this.maxStatementsPerConnection = maxStatementsPerConnection;
|
||||
}
|
||||
|
||||
public String getConnectionTesterClassName() {
|
||||
return connectionTesterClassName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.alibaba.druid.pool;
|
||||
|
||||
public enum StatementCacheAlgorithm {
|
||||
LRU, Fixed
|
||||
}
|
||||
Reference in New Issue
Block a user