C3P0兼容

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@659 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-09-06 14:09:35 +00:00
parent 7e25ec0862
commit 8725ebaf59
2 changed files with 61 additions and 3 deletions
@@ -6,7 +6,7 @@ import java.sql.SQLException;
import javax.sql.DataSource;
public class DruidC3P0WrapDataSource implements DataSource {
public class DruidC3P0WrapDataSource implements DataSource, DruidC3P0WrapDataSourceMBean {
private DruidDataSource dataSource;
@@ -159,6 +159,28 @@ public class DruidC3P0WrapDataSource implements DataSource {
dataSource.setValidationQuery(preferredTestQuery);
}
// /////////////////
@Override
public boolean isEnable() {
return dataSource.isEnable();
}
@Override
public void shrink() {
dataSource.shrink();
}
@Override
public int getWaitThreadCount() {
return dataSource.getWaitThreadCount();
}
@Override
public int getLockQueueLength() {
return dataSource.getLockQueueLength();
}
// ///////////////
private int maxStatementsPerConnection;
@@ -353,6 +375,4 @@ public class DruidC3P0WrapDataSource implements DataSource {
this.breakAfterAcquireFailure = breakAfterAcquireFailure;
}
// ////////////////
}
@@ -0,0 +1,38 @@
package com.alibaba.druid.pool;
public interface DruidC3P0WrapDataSourceMBean {
String getUser();
int getCheckoutTimeout();
boolean isAutoCommitOnClose();
int getIdleConnectionTestPeriod();
int getInitialPoolSize();
int getMaxIdleTime();
int getMaxPoolSize();
int getMinPoolSize();
boolean isTestConnectionOnCheckout();
boolean isTestConnectionOnCheckin();
String getPreferredTestQuery();
// //////////
boolean isEnable();
void shrink();
String toString();
int getWaitThreadCount();
int getLockQueueLength();
}