From d822000dc2ec241915854bb9dd628ea0545339ba Mon Sep 17 00:00:00 2001 From: c7ch23en Date: Mon, 13 Apr 2020 18:00:47 +0800 Subject: [PATCH] minor fix --- .../dal/dao/configure/ClusterDatabaseSetAdapter.java | 8 ++++++++ .../dal/dao/datasource/DefaultDalConnectionLocator.java | 2 +- .../dal/dao/configure/ClusterDatabaseSetTest.java | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSetAdapter.java b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSetAdapter.java index 5d0c089e9..bb051120d 100644 --- a/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSetAdapter.java +++ b/dal-client/src/main/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSetAdapter.java @@ -7,6 +7,7 @@ import com.ctrip.platform.dal.dao.client.DalConnectionLocator; import com.ctrip.platform.dal.dao.cluster.DynamicCluster; import com.ctrip.platform.dal.dao.helper.DalElementFactory; +import com.ctrip.platform.dal.dao.log.DalLogTypes; import com.ctrip.platform.dal.dao.log.ILogger; import java.util.List; @@ -78,11 +79,18 @@ private ClusterDatabaseSet tryAdapt(DefaultDatabaseSet defaultDatabaseSet) { String clusterName = clusterInfo.getClusterName(); ClusterConfig clusterConfig = clusterConfigProvider.getClusterConfig(clusterName); Cluster cluster = new DynamicCluster(clusterConfig); + LOGGER.logEvent(DalLogTypes.DAL_VALIDATION, "ClusterAdaptSucceeded", + String.format("databaseSet: %s, clusterName: %s", + defaultDatabaseSet.getName(), clusterName)); return new ClusterDatabaseSet(defaultDatabaseSet.getName(), cluster, connectionLocator); } } } + LOGGER.logEvent(DalLogTypes.DAL_VALIDATION, "ClusterAdaptSkipped", String.format("databaseSet: %s", + defaultDatabaseSet.getName())); } catch (Throwable t) { + LOGGER.logEvent(DalLogTypes.DAL_VALIDATION, "ClusterAdaptFailed", String.format("databaseSet: %s", + defaultDatabaseSet.getName())); LOGGER.warn("Adapt DefaultDatabaseSet to ClusterDatabaseSet exception", t); } return null; diff --git a/dal-client/src/main/java/com/ctrip/platform/dal/dao/datasource/DefaultDalConnectionLocator.java b/dal-client/src/main/java/com/ctrip/platform/dal/dao/datasource/DefaultDalConnectionLocator.java index 08c82dc39..6d819e63e 100644 --- a/dal-client/src/main/java/com/ctrip/platform/dal/dao/datasource/DefaultDalConnectionLocator.java +++ b/dal-client/src/main/java/com/ctrip/platform/dal/dao/datasource/DefaultDalConnectionLocator.java @@ -61,7 +61,7 @@ public Connection getConnection(DataSourceIdentity id) throws Exception { } @Override - public ClusterConfigProvider getClusterConfigProvider() { + public IntegratedConfigProvider getIntegratedConfigProvider() { return provider; } diff --git a/dal-client/src/test/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSetTest.java b/dal-client/src/test/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSetTest.java index df2359701..c48c2fa33 100644 --- a/dal-client/src/test/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSetTest.java +++ b/dal-client/src/test/java/com/ctrip/platform/dal/dao/configure/ClusterDatabaseSetTest.java @@ -39,7 +39,7 @@ public Connection getConnection(DataSourceIdentity id) throws Exception { } @Override - public com.ctrip.platform.dal.dao.configure.ClusterConfigProvider getClusterConfigProvider() { + public IntegratedConfigProvider getIntegratedConfigProvider() { return null; }