mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
@@ -19,11 +19,13 @@ import java.sql.Driver;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.druid.filter.Filter;
|
||||
import com.alibaba.druid.stat.JdbcDataSourceStat;
|
||||
|
||||
/**
|
||||
* @author wenshao<szujobs@hotmail.com>
|
||||
*/
|
||||
public interface DataSourceProxy {
|
||||
JdbcDataSourceStat getDataSourceStat();
|
||||
|
||||
String getName();
|
||||
|
||||
|
||||
@@ -60,11 +60,14 @@ public class DataSourceProxyImpl implements DataSourceProxy, DataSourceProxyImpl
|
||||
private final AtomicLong resultSetIdSeed = new AtomicLong(50000);
|
||||
private final AtomicLong transactionIdSeed = new AtomicLong(0);
|
||||
|
||||
private final JdbcDataSourceStat dataSourceStat;
|
||||
|
||||
public DataSourceProxyImpl(Driver rawDriver, DataSourceProxyConfig config){
|
||||
super();
|
||||
this.rawDriver = rawDriver;
|
||||
this.config = config;
|
||||
this.dbType = JdbcUtils.getDbType(config.getRawUrl(), config.getRawDriverClassName());
|
||||
this.dataSourceStat = new JdbcDataSourceStat(config.getName(), config.getUrl());
|
||||
}
|
||||
|
||||
public String getDbType() {
|
||||
@@ -370,4 +373,9 @@ public class DataSourceProxyImpl implements DataSourceProxy, DataSourceProxyImpl
|
||||
public long createTransactionId() {
|
||||
return transactionIdSeed.getAndIncrement();
|
||||
}
|
||||
|
||||
public JdbcDataSourceStat getDataSourceStat() {
|
||||
return dataSourceStat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user