mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
ha
This commit is contained in:
@@ -28,9 +28,13 @@ public class CobarConfigLoader extends URLConnectionConfigLoader implements Conf
|
||||
public CobarDataSource getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
public static boolean isCobar(String url) {
|
||||
return url.startsWith("jdbc:cobar://");
|
||||
}
|
||||
|
||||
public static URL createURL(String jdbcUrl) throws SQLException {
|
||||
if (!CobarDataSource.isCobar(jdbcUrl)) {
|
||||
if (!isCobar(jdbcUrl)) {
|
||||
throw new SQLException("illegal cobar url");
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,7 @@ import com.alibaba.druid.logging.Log;
|
||||
import com.alibaba.druid.logging.LogFactory;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.ha.DataSourceHolder;
|
||||
import com.alibaba.druid.pool.ha.MultiConnectionHolder;
|
||||
import com.alibaba.druid.pool.ha.MultiDataSource;
|
||||
import com.alibaba.druid.pool.ha.MultiDataSourceConnection;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
public class CobarDataSource extends MultiDataSource {
|
||||
@@ -27,8 +25,6 @@ public class CobarDataSource extends MultiDataSource {
|
||||
private List<Filter> proxyFilters = new ArrayList<Filter>();
|
||||
private String filters;
|
||||
|
||||
|
||||
|
||||
public CobarDataSource(){
|
||||
|
||||
}
|
||||
@@ -78,7 +74,7 @@ public class CobarDataSource extends MultiDataSource {
|
||||
throw new SQLException("");
|
||||
}
|
||||
|
||||
if (isCobar(url)) {
|
||||
if (CobarConfigLoader.isCobar(url)) {
|
||||
this.setConfigLoader(new CobarConfigLoader(this));
|
||||
} else {
|
||||
DataSourceHolder holder = createDataSourceHolder(this.url, 1);
|
||||
@@ -106,14 +102,4 @@ public class CobarDataSource extends MultiDataSource {
|
||||
JdbcUtils.close(holder);
|
||||
}
|
||||
|
||||
public static boolean isCobar(String url) {
|
||||
return url.startsWith("jdbc:cobar://");
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiConnectionHolder getConnectionInternal(MultiDataSourceConnection conn, String sql) throws SQLException {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user