diff --git a/dal-client/pom.xml b/dal-client/pom.xml
index 393e2224b..70faad09c 100644
--- a/dal-client/pom.xml
+++ b/dal-client/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.ctrip.platform
dal-client
- 2.0.3
+ 2.0.4
1.8
diff --git a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSet.java b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSet.java
index 91c1911b8..03ae3f717 100644
--- a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSet.java
+++ b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSet.java
@@ -19,7 +19,7 @@
/**
* @author c7ch23en
*/
-public class ClusterDatabaseSet implements DatabaseSet {
+public class ClusterDatabaseSet extends DatabaseSet {
private String databaseSetName;
private Cluster cluster;
diff --git a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/DatabaseSet.java b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/DatabaseSet.java
index 27dad08b4..b43e50db2 100644
--- a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/DatabaseSet.java
+++ b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/DatabaseSet.java
@@ -14,36 +14,81 @@
import com.ctrip.platform.dal.exceptions.DalException;
import com.ctrip.platform.dal.sharding.idgen.IIdGeneratorConfig;
-public interface DatabaseSet {
-
- String getName();
-
- String getProvider();
-
- DatabaseCategory getDatabaseCategory();
-
- boolean isShardingSupported();
-
- boolean isTableShardingSupported(String tableName);
-
- Map getDatabases();
-
- void validate(String shard) throws SQLException;
-
- Set getAllShards();
-
- Set getAllTableShards(String tableName) throws SQLException;
-
- DalShardingStrategy getStrategy() throws SQLException;
-
- List getMasterDbs();
-
- List getSlaveDbs();
-
- List getMasterDbs(String shard);
-
- List getSlaveDbs(String shard);
-
- IIdGeneratorConfig getIdGenConfig();
+public abstract class DatabaseSet implements IDatabaseSet {
+
+ @Override
+ public String getName() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public String getProvider() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public DatabaseCategory getDatabaseCategory() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public boolean isShardingSupported() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public boolean isTableShardingSupported(String tableName) {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public Map getDatabases() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public void validate(String shard) throws SQLException {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public Set getAllShards() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public Set getAllTableShards(String tableName) throws SQLException {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public DalShardingStrategy getStrategy() throws SQLException {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public List getMasterDbs() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public List getSlaveDbs() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public List getMasterDbs(String shard) {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public List getSlaveDbs(String shard) {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
+
+ @Override
+ public IIdGeneratorConfig getIdGenConfig() {
+ throw new UnsupportedOperationException("This is an abstract DatabaseSet.");
+ }
}
diff --git a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/DefaultDatabaseSet.java b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/DefaultDatabaseSet.java
index ca5bf6800..a93e0c6f8 100644
--- a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/DefaultDatabaseSet.java
+++ b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/DefaultDatabaseSet.java
@@ -14,7 +14,7 @@
import com.ctrip.platform.dal.exceptions.DalException;
import com.ctrip.platform.dal.sharding.idgen.IIdGeneratorConfig;
-public class DefaultDatabaseSet implements DatabaseSet {
+public class DefaultDatabaseSet extends DatabaseSet {
private static final String CLASS = "class";
private static final String ENTRY_SEPARATOR = ";";
private static final String KEY_VALUE_SEPARATOR = "=";
diff --git a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/IDatabaseSet.java b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/IDatabaseSet.java
new file mode 100644
index 000000000..57f95413d
--- /dev/null
+++ b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/IDatabaseSet.java
@@ -0,0 +1,44 @@
+package com.ctrip.platform.dal.dao.configure;
+
+import com.ctrip.platform.dal.common.enums.DatabaseCategory;
+import com.ctrip.platform.dal.dao.strategy.DalShardingStrategy;
+import com.ctrip.platform.dal.sharding.idgen.IIdGeneratorConfig;
+
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public interface IDatabaseSet {
+
+ String getName();
+
+ String getProvider();
+
+ DatabaseCategory getDatabaseCategory();
+
+ boolean isShardingSupported();
+
+ boolean isTableShardingSupported(String tableName);
+
+ Map getDatabases();
+
+ void validate(String shard) throws SQLException;
+
+ Set getAllShards();
+
+ Set getAllTableShards(String tableName) throws SQLException;
+
+ DalShardingStrategy getStrategy() throws SQLException;
+
+ List getMasterDbs();
+
+ List getSlaveDbs();
+
+ List getMasterDbs(String shard);
+
+ List getSlaveDbs(String shard);
+
+ IIdGeneratorConfig getIdGenConfig();
+
+}
diff --git a/dal-client/src/main/java/com/ctrip/platform/dal/dao/datasource/DataSourceLocator.java b/dal-client/src/main/java/com/ctrip/platform/dal/dao/datasource/DataSourceLocator.java
index aaf47310c..f4f487973 100644
--- a/dal-client/src/main/java/com/ctrip/platform/dal/dao/datasource/DataSourceLocator.java
+++ b/dal-client/src/main/java/com/ctrip/platform/dal/dao/datasource/DataSourceLocator.java
@@ -77,6 +77,7 @@ public DataSource getDataSource(DataSourceIdentity id) {
public void removeDataSource(DataSourceIdentity id) {
DataSource ds = cache.remove(id);
+ provider.unregister(id);
if (ds instanceof RefreshableDataSource) {
((RefreshableDataSource) ds).close();
}
@@ -96,8 +97,7 @@ private DataSource createDataSource(DataSourceIdentity id) throws SQLException {
return ds;
}
- public void setup(Cluster cluster) {
- }
+ public void setup(Cluster cluster) {}
public static Map getActiveConnectionNumber() {
Map map = new HashMap<>();
diff --git a/dal-client/src/main/java/com/ctrip/platform/dal/dao/task/InsertTaskAdapter.java b/dal-client/src/main/java/com/ctrip/platform/dal/dao/task/InsertTaskAdapter.java
index cfac50f16..fb692515f 100644
--- a/dal-client/src/main/java/com/ctrip/platform/dal/dao/task/InsertTaskAdapter.java
+++ b/dal-client/src/main/java/com/ctrip/platform/dal/dao/task/InsertTaskAdapter.java
@@ -139,7 +139,7 @@ public void processIdentityField(DalHints hints, List