mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
支持HA
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@463 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.alibaba.druid.pool.DataSourceAdapter;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
@@ -14,7 +15,18 @@ public abstract class MultiDataSource extends DataSourceAdapter {
|
||||
|
||||
protected ArrayList<DruidDataSource> dataSources;
|
||||
|
||||
private Properties properties = new Properties();
|
||||
private Properties properties = new Properties();
|
||||
|
||||
private final AtomicInteger connectionIdSeed = new AtomicInteger();
|
||||
private final AtomicInteger statementIdSeed = new AtomicInteger();
|
||||
|
||||
public int createConnectionId() {
|
||||
return connectionIdSeed.getAndIncrement();
|
||||
}
|
||||
|
||||
public int createStatementId() {
|
||||
return statementIdSeed.getAndIncrement();
|
||||
}
|
||||
|
||||
public MultiDataSource(){
|
||||
dataSources = new ArrayList<DruidDataSource>();
|
||||
@@ -35,4 +47,6 @@ public abstract class MultiDataSource extends DataSourceAdapter {
|
||||
|
||||
@Override
|
||||
public abstract Connection getConnection() throws SQLException;
|
||||
|
||||
public abstract Connection getConnectionInternal(int connectionId, String sql) throws SQLException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user