This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 17e3305 Rename DataSourceCreator and DataSourceDestroyer to
DataSourcePoolCreator and DataSourcePoolDestroyer (#14057)
17e3305 is described below
commit 17e3305ff821a47e8177cbeeb85bfa5d2b1f9993
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Dec 12 01:38:10 2021 +0800
Rename DataSourceCreator and DataSourceDestroyer to DataSourcePoolCreator
and DataSourcePoolDestroyer (#14057)
* Refactor DefaultDataSourceCreatorTest
* Rename DataSourcePoolCreator
* Rename DataSourcePoolDestroyer
* Update document
* Update doc
* For checkstyle
---
docs/document/content/dev-manual/data-source.cn.md | 32 +++++++++++-----------
docs/document/content/dev-manual/data-source.en.md | 32 +++++++++++-----------
.../config/datasource/DataSourceConverter.java | 6 ++--
.../creator/DataSourcePoolCreator.java} | 8 +++---
.../creator/DataSourcePoolCreatorFactory.java} | 16 +++++------
.../impl/AbstractDataSourcePoolCreator.java} | 8 +++---
.../impl/DefaultDataSourcePoolCreator.java} | 6 ++--
.../creator/impl/HikariDataSourcePoolCreator.java} | 8 +++---
.../destroyer/DataSourcePoolDestroyer.java} | 8 +++---
.../destroyer/DataSourcePoolDestroyerFactory.java} | 17 ++++++------
.../impl/DefaultDataSourcePoolDestroyer.java} | 8 +++---
.../impl/HikariDataSourcePoolDestroyer.java} | 8 +++---
.../metadata/resource/ShardingSphereResource.java | 4 +--
....datasource.pool.creator.DataSourcePoolCreator} | 4 +--
...asource.pool.destroyer.DataSourcePoolDestroyer} | 4 +--
.../creator/DefaultDataSourcePoolCreatorTest.java} | 10 +++----
...t.java => HikariDataSourcePoolCreatorTest.java} | 18 ++++++------
17 files changed, 99 insertions(+), 98 deletions(-)
diff --git a/docs/document/content/dev-manual/data-source.cn.md
b/docs/document/content/dev-manual/data-source.cn.md
index 4ac5f5b..2cf5495 100644
--- a/docs/document/content/dev-manual/data-source.cn.md
+++ b/docs/document/content/dev-manual/data-source.cn.md
@@ -37,24 +37,24 @@ chapter = true
| H2TableMetaDataLoader | 使用 H2 方言加载元数据 |
| OpenGaussTableMetaDataLoader | 使用 OpenGauss 方言加载元数据 |
-## DataSourceCreator
+## DataSourcePoolCreator
-| *SPI 名称* | *详细说明* |
-| ------------------------ | ----------------- |
-| DataSourceCreator | 数据源创建器 |
+| *SPI 名称* | *详细说明* |
+| ---------------------------- | ---------------------- |
+| DataSourcePoolCreator | 数据源连接池创建器 |
-| *已知实现类* | *详细说明* |
-| ------------------------ | ----------------- |
-| DefaultDataSourceCreator | 默认数据源创建器 |
-| HikariDataSourceCreator | Hikari 数据源创建器 |
+| *已知实现类* | *详细说明* |
+| ---------------------------- | ---------------------- |
+| DefaultDataSourcePoolCreator | 默认数据源连接池创建器 |
+| HikariDataSourcePoolCreator | Hikari 数据源连接池创建器 |
-## DataSourceDestroyer
+## DataSourcePoolDestroyer
-| *SPI 名称* | *详细说明* |
-| -------------------------- | ----------------- |
-| DataSourceDestroyer | 数据源销毁器 |
+| *SPI 名称* | *详细说明* |
+| ------------------------------ | ---------------------- |
+| DataSourcePoolDestroyer | 数据源连接池销毁器 |
-| *已知实现类* | *详细说明* |
-| -------------------------- | ----------------- |
-| DefaultDataSourceDestroyer | 默认数据源销毁器 |
-| HikariDataSourceDestroyer | Hikari 数据源销毁器 |
+| *已知实现类* | *详细说明* |
+| ------------------------------ | ---------------------- |
+| DefaultDataSourcePoolDestroyer | 默认数据源连接池销毁器 |
+| HikariDataSourcePoolDestroyer | Hikari 数据源连接池销毁器 |
diff --git a/docs/document/content/dev-manual/data-source.en.md
b/docs/document/content/dev-manual/data-source.en.md
index 1255a6b..c5d3f39 100644
--- a/docs/document/content/dev-manual/data-source.en.md
+++ b/docs/document/content/dev-manual/data-source.en.md
@@ -37,24 +37,24 @@ chapter = true
| H2TableMetaDataLoader | Use H2 dialect to load meta data |
| OpenGaussTableMetaDataLoader | Use OpenGauss dialect to load meta data |
-## DataSourceCreator
+## DataSourcePoolCreator
-| *SPI Name* | *Description* |
-| ------------------------ | --------------------------- |
-| DataSourceCreator | Data source creator |
+| *SPI Name* | *Description* |
+| ---------------------------- | -------------------------------- |
+| DataSourcePoolCreator | Data source pool creator |
-| *Implementation Class* | *Description* |
-| ------------------------ | --------------------------- |
-| DefaultDataSourceCreator | Default data source creator |
-| HikariDataSourceCreator | Hikari data source creator |
+| *Implementation Class* | *Description* |
+| ---------------------------- | -------------------------------- |
+| DefaultDataSourcePoolCreator | Default data source pool creator |
+| HikariDataSourcePoolCreator | Hikari data source pool creator |
-## DataSourceDestroyer
+## DataSourcePoolDestroyer
-| *SPI Name* | *Description* |
-| -------------------------- | ----------------------------- |
-| DataSourceDestroyer | Default data source destroyer |
+| *SPI Name* | *Description* |
+| ------------------------------ | ---------------------------------- |
+| DataSourcePoolDestroyer | Data source pool destroyer |
-| *Implementation Class* | *Description* |
-| -------------------------- | ----------------------------- |
-| DefaultDataSourceDestroyer | Default data source destroyer |
-| HikariDataSourceDestroyer | Hikari data source destroyer |
+| *Implementation Class* | *Description* |
+| ------------------------------ | ---------------------------------- |
+| DefaultDataSourcePoolDestroyer | Default data source pool destroyer |
+| HikariDataSourcePoolDestroyer | Hikari data source pool destroyer |
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConverter.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConverter.java
index d0c0a81..c5af2c1 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConverter.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConverter.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.infra.config.datasource;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.infra.config.datasource.creator.DataSourceCreatorFactory;
+import
org.apache.shardingsphere.infra.config.datasource.pool.creator.DataSourcePoolCreatorFactory;
import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
import javax.sql.DataSource;
@@ -45,7 +45,7 @@ public final class DataSourceConverter {
* @return data source
*/
public static DataSource getDataSource(final DataSourceConfiguration
dataSourceConfiguration) {
- return
JDBCParameterDecoratorHelper.decorate(DataSourceCreatorFactory.getDataSourceCreator(dataSourceConfiguration.getDataSourceClassName()).createDataSource(dataSourceConfiguration));
+ return
JDBCParameterDecoratorHelper.decorate(DataSourcePoolCreatorFactory.getInstance(dataSourceConfiguration.getDataSourceClassName()).createDataSource(dataSourceConfiguration));
}
/**
@@ -55,7 +55,7 @@ public final class DataSourceConverter {
* @return data source configuration
*/
public static DataSourceConfiguration getDataSourceConfiguration(final
DataSource dataSource) {
- return
DataSourceCreatorFactory.getDataSourceCreator(dataSource.getClass().getName()).createDataSourceConfiguration(dataSource);
+ return
DataSourcePoolCreatorFactory.getInstance(dataSource.getClass().getName()).createDataSourceConfiguration(dataSource);
}
/**
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/DataSourceCreator.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourcePoolCreator.java
similarity index 87%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/DataSourceCreator.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourcePoolCreator.java
index ae40304..cc6ab97 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/DataSourceCreator.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourcePoolCreator.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.creator;
+package org.apache.shardingsphere.infra.config.datasource.pool.creator;
import
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.spi.required.RequiredSPI;
@@ -24,9 +24,9 @@ import org.apache.shardingsphere.spi.typed.TypedSPI;
import javax.sql.DataSource;
/**
- * Data source creator.
+ * Data source pool creator.
*/
-public interface DataSourceCreator extends TypedSPI, RequiredSPI {
+public interface DataSourcePoolCreator extends TypedSPI, RequiredSPI {
/**
* Create data source configuration by data source.
@@ -37,7 +37,7 @@ public interface DataSourceCreator extends TypedSPI,
RequiredSPI {
DataSourceConfiguration createDataSourceConfiguration(DataSource
dataSource);
/**
- * Create data source by data source configuration.
+ * Create data source.
*
* @param dataSourceConfig data source configuration
* @return data source
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/DataSourceDestroyerFactory.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourcePoolCreatorFactory.java
similarity index 68%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/DataSourceDestroyerFactory.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourcePoolCreatorFactory.java
index d1c117b..d0a0f14 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/DataSourceDestroyerFactory.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DataSourcePoolCreatorFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.destroyer;
+package org.apache.shardingsphere.infra.config.datasource.pool.creator;
import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.spi.required.RequiredSPIRegistry;
@@ -24,21 +24,21 @@ import org.apache.shardingsphere.spi.typed.TypedSPIRegistry;
import java.util.Properties;
/**
- * Data source destroyer factory.
+ * Data source pool creator factory.
*/
-public final class DataSourceDestroyerFactory {
+public final class DataSourcePoolCreatorFactory {
static {
- ShardingSphereServiceLoader.register(DataSourceDestroyer.class);
+ ShardingSphereServiceLoader.register(DataSourcePoolCreator.class);
}
/**
- * Get data source destroyer instance.
+ * Get data source pool creator instance.
*
* @param dataSourceClassName data source class name
- * @return instance of data source destroyer
+ * @return data source pool creator instance
*/
- public static DataSourceDestroyer getInstance(final String
dataSourceClassName) {
- return
TypedSPIRegistry.findRegisteredService(DataSourceDestroyer.class,
dataSourceClassName, new
Properties()).orElse(RequiredSPIRegistry.getRegisteredService(DataSourceDestroyer.class));
+ public static DataSourcePoolCreator getInstance(final String
dataSourceClassName) {
+ return
TypedSPIRegistry.findRegisteredService(DataSourcePoolCreator.class,
dataSourceClassName, new
Properties()).orElse(RequiredSPIRegistry.getRegisteredService(DataSourcePoolCreator.class));
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/AbstractDataSourceCreator.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/AbstractDataSourcePoolCreator.java
similarity index 96%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/AbstractDataSourceCreator.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/AbstractDataSourcePoolCreator.java
index f14ee36..f9de318 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/AbstractDataSourceCreator.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/AbstractDataSourcePoolCreator.java
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.creator.impl;
+package org.apache.shardingsphere.infra.config.datasource.pool.creator.impl;
import com.google.common.base.CaseFormat;
import com.google.common.collect.Sets;
import lombok.SneakyThrows;
import
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
-import
org.apache.shardingsphere.infra.config.datasource.creator.DataSourceCreator;
+import
org.apache.shardingsphere.infra.config.datasource.pool.creator.DataSourcePoolCreator;
import
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
import javax.sql.DataSource;
@@ -37,9 +37,9 @@ import java.util.Map.Entry;
import java.util.Optional;
/**
- * Abstract data source creator.
+ * Abstract data source pool creator.
*/
-public abstract class AbstractDataSourceCreator implements DataSourceCreator {
+public abstract class AbstractDataSourcePoolCreator implements
DataSourcePoolCreator {
static {
GENERAL_CLASS_TYPES = Sets.newHashSet(boolean.class, Boolean.class,
int.class, Integer.class, long.class, Long.class, String.class,
Collection.class, List.class);
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/DefaultDataSourceCreator.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/DefaultDataSourcePoolCreator.java
similarity index 86%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/DefaultDataSourceCreator.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/DefaultDataSourcePoolCreator.java
index b7ef841..6ecc5d1 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/DefaultDataSourceCreator.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/DefaultDataSourcePoolCreator.java
@@ -15,15 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.creator.impl;
+package org.apache.shardingsphere.infra.config.datasource.pool.creator.impl;
import java.util.Collections;
import java.util.Map;
/**
- * Default data source creator.
+ * Default data source pool creator.
*/
-public final class DefaultDataSourceCreator extends AbstractDataSourceCreator {
+public final class DefaultDataSourcePoolCreator extends
AbstractDataSourcePoolCreator {
@Override
protected Map<String, String> getPropertySynonyms() {
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/HikariDataSourceCreator.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/HikariDataSourcePoolCreator.java
similarity index 87%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/HikariDataSourceCreator.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/HikariDataSourcePoolCreator.java
index cc8e780..ba1c265 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/impl/HikariDataSourceCreator.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/impl/HikariDataSourcePoolCreator.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.creator.impl;
+package org.apache.shardingsphere.infra.config.datasource.pool.creator.impl;
import com.zaxxer.hikari.HikariDataSource;
import lombok.Getter;
@@ -24,16 +24,16 @@ import java.util.HashMap;
import java.util.Map;
/**
- * Hikari data source creator.
+ * Hikari data source pool creator.
*/
@Getter
-public final class HikariDataSourceCreator extends AbstractDataSourceCreator {
+public final class HikariDataSourcePoolCreator extends
AbstractDataSourcePoolCreator {
private final Map<String, String> propertySynonyms = new HashMap<>(2, 1);
private final Map<String, Object> invalidProperties = new HashMap<>(2, 1);
- public HikariDataSourceCreator() {
+ public HikariDataSourcePoolCreator() {
buildPropertySynonyms();
buildInvalidProperties();
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/DataSourceDestroyer.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/DataSourcePoolDestroyer.java
similarity index 83%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/DataSourceDestroyer.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/DataSourcePoolDestroyer.java
index a7d4b40..e910ae4 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/DataSourceDestroyer.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/DataSourcePoolDestroyer.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.destroyer;
+package org.apache.shardingsphere.infra.config.datasource.pool.destroyer;
import org.apache.shardingsphere.spi.required.RequiredSPI;
import org.apache.shardingsphere.spi.typed.TypedSPI;
@@ -23,12 +23,12 @@ import javax.sql.DataSource;
import java.sql.SQLException;
/**
- * Data source destroyer.
+ * Data source pool destroyer.
*/
-public interface DataSourceDestroyer extends TypedSPI, RequiredSPI {
+public interface DataSourcePoolDestroyer extends TypedSPI, RequiredSPI {
/**
- * destroy data source gracefully.
+ * destroy data source pool gracefully.
*
* @param dataSource data source
* @throws SQLException SQL exception
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/DataSourceCreatorFactory.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/DataSourcePoolDestroyerFactory.java
similarity index 67%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/DataSourceCreatorFactory.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/DataSourcePoolDestroyerFactory.java
index 2af12aa..78fa0ee 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/creator/DataSourceCreatorFactory.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/DataSourcePoolDestroyerFactory.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.creator;
+package org.apache.shardingsphere.infra.config.datasource.pool.destroyer;
import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.spi.required.RequiredSPIRegistry;
@@ -24,21 +24,22 @@ import org.apache.shardingsphere.spi.typed.TypedSPIRegistry;
import java.util.Properties;
/**
- * Data source creator factory.
+ * Data source pool destroyer factory.
*/
-public final class DataSourceCreatorFactory {
+public final class DataSourcePoolDestroyerFactory {
static {
- ShardingSphereServiceLoader.register(DataSourceCreator.class);
+ ShardingSphereServiceLoader.register(DataSourcePoolDestroyer.class);
}
/**
- * Get data source creator.
+ * Get data source pool destroyer instance.
*
* @param dataSourceClassName data source class name
- * @return data source creator
+ * @return instance of data source pool destroyer
*/
- public static DataSourceCreator getDataSourceCreator(final String
dataSourceClassName) {
- return TypedSPIRegistry.findRegisteredService(DataSourceCreator.class,
dataSourceClassName, new
Properties()).orElse(RequiredSPIRegistry.getRegisteredService(DataSourceCreator.class));
+ public static DataSourcePoolDestroyer getInstance(final String
dataSourceClassName) {
+ return
TypedSPIRegistry.findRegisteredService(DataSourcePoolDestroyer.class,
dataSourceClassName, new Properties())
+
.orElse(RequiredSPIRegistry.getRegisteredService(DataSourcePoolDestroyer.class));
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/impl/DefaultDataSourceDestroyer.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/impl/DefaultDataSourcePoolDestroyer.java
similarity index 82%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/impl/DefaultDataSourceDestroyer.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/impl/DefaultDataSourcePoolDestroyer.java
index 3c67459..9c1aab5 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/impl/DefaultDataSourceDestroyer.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/impl/DefaultDataSourcePoolDestroyer.java
@@ -15,17 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.destroyer.impl;
+package org.apache.shardingsphere.infra.config.datasource.pool.destroyer.impl;
-import
org.apache.shardingsphere.infra.config.datasource.destroyer.DataSourceDestroyer;
+import
org.apache.shardingsphere.infra.config.datasource.pool.destroyer.DataSourcePoolDestroyer;
import javax.sql.DataSource;
import java.sql.SQLException;
/**
- * Default data source destroyer.
+ * Default data source pool destroyer.
*/
-public final class DefaultDataSourceDestroyer implements DataSourceDestroyer {
+public final class DefaultDataSourcePoolDestroyer implements
DataSourcePoolDestroyer {
@Override
public void destroy(final DataSource dataSource) throws SQLException {
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/impl/HikariDataSourceDestroyer.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/impl/HikariDataSourcePoolDestroyer.java
similarity index 85%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/impl/HikariDataSourceDestroyer.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/impl/HikariDataSourcePoolDestroyer.java
index 5ad69de..1c14880 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/destroyer/impl/HikariDataSourceDestroyer.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/pool/destroyer/impl/HikariDataSourcePoolDestroyer.java
@@ -15,19 +15,19 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.destroyer.impl;
+package org.apache.shardingsphere.infra.config.datasource.pool.destroyer.impl;
import com.zaxxer.hikari.HikariDataSource;
-import
org.apache.shardingsphere.infra.config.datasource.destroyer.DataSourceDestroyer;
+import
org.apache.shardingsphere.infra.config.datasource.pool.destroyer.DataSourcePoolDestroyer;
import javax.sql.DataSource;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
- * Hikari data source destroyer.
+ * Hikari data source pool destroyer.
*/
-public final class HikariDataSourceDestroyer implements DataSourceDestroyer {
+public final class HikariDataSourcePoolDestroyer implements
DataSourcePoolDestroyer {
@Override
public void destroy(final DataSource dataSource) {
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResource.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResource.java
index 2a75c67..982893d 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResource.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/resource/ShardingSphereResource.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.infra.metadata.resource;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.infra.config.datasource.destroyer.DataSourceDestroyerFactory;
+import
org.apache.shardingsphere.infra.config.datasource.pool.destroyer.DataSourcePoolDestroyerFactory;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import javax.sql.DataSource;
@@ -82,6 +82,6 @@ public final class ShardingSphereResource {
* @throws SQLException SQL exception
*/
public void close(final DataSource dataSource) throws SQLException {
-
DataSourceDestroyerFactory.getInstance(dataSource.getClass().getName()).destroy(dataSource);
+
DataSourcePoolDestroyerFactory.getInstance(dataSource.getClass().getName()).destroy(dataSource);
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.creator.DataSourceCreator
b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.pool.creator.DataSourcePoolCreator
similarity index 80%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.creator.DataSourceCreator
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.pool.creator.DataSourcePoolCreator
index f1fc3b0..7719026 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.creator.DataSourceCreator
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.pool.creator.DataSourcePoolCreator
@@ -15,5 +15,5 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.config.datasource.creator.impl.HikariDataSourceCreator
-org.apache.shardingsphere.infra.config.datasource.creator.impl.DefaultDataSourceCreator
+org.apache.shardingsphere.infra.config.datasource.pool.creator.impl.HikariDataSourcePoolCreator
+org.apache.shardingsphere.infra.config.datasource.pool.creator.impl.DefaultDataSourcePoolCreator
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.destroyer.DataSourceDestroyer
b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.pool.destroyer.DataSourcePoolDestroyer
similarity index 79%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.destroyer.DataSourceDestroyer
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.pool.destroyer.DataSourcePoolDestroyer
index c44e525..4915f5e 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.destroyer.DataSourceDestroyer
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.pool.destroyer.DataSourcePoolDestroyer
@@ -15,5 +15,5 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.config.datasource.destroyer.impl.DefaultDataSourceDestroyer
-org.apache.shardingsphere.infra.config.datasource.destroyer.impl.HikariDataSourceDestroyer
+org.apache.shardingsphere.infra.config.datasource.pool.destroyer.impl.DefaultDataSourcePoolDestroyer
+org.apache.shardingsphere.infra.config.datasource.pool.destroyer.impl.HikariDataSourcePoolDestroyer
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/creator/DefaultDataSourceCreatorTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DefaultDataSourcePoolCreatorTest.java
similarity index 84%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/creator/DefaultDataSourceCreatorTest.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DefaultDataSourcePoolCreatorTest.java
index c56d86a..af4c813 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/creator/DefaultDataSourceCreatorTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/datasource/pool/creator/DefaultDataSourcePoolCreatorTest.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config.datasource.creator;
+package org.apache.shardingsphere.infra.config.datasource.pool.creator;
import com.zaxxer.hikari.HikariDataSource;
import
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
-import
org.apache.shardingsphere.infra.config.datasource.creator.impl.DefaultDataSourceCreator;
+import
org.apache.shardingsphere.infra.config.datasource.pool.creator.impl.DefaultDataSourcePoolCreator;
import org.junit.Test;
import javax.sql.DataSource;
@@ -27,11 +27,11 @@ import javax.sql.DataSource;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-public final class DefaultDataSourceCreatorTest {
+public final class DefaultDataSourcePoolCreatorTest {
@Test
public void assertCreateDataSourceConfiguration() {
- assertThat(new
DefaultDataSourceCreator().createDataSourceConfiguration(createDataSource()),
is(createDataSourceConfiguration()));
+ assertThat(new
DefaultDataSourcePoolCreator().createDataSourceConfiguration(createDataSource()),
is(createDataSourceConfiguration()));
}
private DataSource createDataSource() {
@@ -45,7 +45,7 @@ public final class DefaultDataSourceCreatorTest {
@Test
public void assertCreateDataSource() {
- HikariDataSource actual = (HikariDataSource) new
DefaultDataSourceCreator().createDataSource(createDataSourceConfiguration());
+ HikariDataSource actual = (HikariDataSource) new
DefaultDataSourcePoolCreator().createDataSource(createDataSourceConfiguration());
assertThat(actual.getUsername(), is("root"));
assertThat(actual.getPassword(), is("root"));
assertThat(actual.getDriverClassName(), is("org.h2.Driver"));
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datasource/creator/HikariDataSourceCreatorTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datasource/creator/HikariDataSourcePoolCreatorTest.java
similarity index 82%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datasource/creator/HikariDataSourceCreatorTest.java
rename to
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datasource/creator/HikariDataSourcePoolCreatorTest.java
index 39a0d8f..3695492 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datasource/creator/HikariDataSourceCreatorTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datasource/creator/HikariDataSourcePoolCreatorTest.java
@@ -19,9 +19,9 @@ package org.apache.shardingsphere.infra.datasource.creator;
import com.zaxxer.hikari.HikariDataSource;
import
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
-import
org.apache.shardingsphere.infra.config.datasource.creator.DataSourceCreator;
-import
org.apache.shardingsphere.infra.config.datasource.creator.impl.DefaultDataSourceCreator;
-import
org.apache.shardingsphere.infra.config.datasource.creator.impl.HikariDataSourceCreator;
+import
org.apache.shardingsphere.infra.config.datasource.pool.creator.DataSourcePoolCreator;
+import
org.apache.shardingsphere.infra.config.datasource.pool.creator.impl.DefaultDataSourcePoolCreator;
+import
org.apache.shardingsphere.infra.config.datasource.pool.creator.impl.HikariDataSourcePoolCreator;
import org.junit.Test;
import javax.sql.DataSource;
@@ -33,7 +33,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
-public final class HikariDataSourceCreatorTest {
+public final class HikariDataSourcePoolCreatorTest {
@Test
public void assertCreateDataSourceConfigurationWithoutDriverClassName() {
@@ -41,15 +41,15 @@ public final class HikariDataSourceCreatorTest {
dataSource.setJdbcUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL");
dataSource.setUsername("root");
dataSource.setPassword("root");
- DataSourceConfiguration dataSourceConfiguration = new
DefaultDataSourceCreator().createDataSourceConfiguration(dataSource);
+ DataSourceConfiguration dataSourceConfiguration = new
DefaultDataSourcePoolCreator().createDataSourceConfiguration(dataSource);
Map<String, Object> props = dataSourceConfiguration.getProps();
assertFalse(props.containsKey("driverClassName") && null ==
props.get("driverClassName"));
}
@Test
public void assertCreateDataSourceConfiguration() {
- DataSourceCreator dataSourceCreator = new HikariDataSourceCreator();
- DataSourceConfiguration configuration =
dataSourceCreator.createDataSourceConfiguration(dataSourceCreator.createDataSource(createDataSourceConfiguration()));
+ DataSourcePoolCreator dataSourcePoolCreator = new
HikariDataSourcePoolCreator();
+ DataSourceConfiguration configuration =
dataSourcePoolCreator.createDataSourceConfiguration(dataSourcePoolCreator.createDataSource(createDataSourceConfiguration()));
assertThat(configuration.getDataSourceClassName(),
is("com.zaxxer.hikari.HikariDataSource"));
assertThat(configuration.getProps().get("jdbcUrl"),
is("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL"));
assertThat(configuration.getProps().get("driverClassName"),
is("org.h2.Driver"));
@@ -61,8 +61,8 @@ public final class HikariDataSourceCreatorTest {
@Test
public void assertCreateDataSource() {
- DataSourceCreator dataSourceCreator = new HikariDataSourceCreator();
- DataSource dataSource =
dataSourceCreator.createDataSource(createDataSourceConfiguration());
+ DataSourcePoolCreator dataSourcePoolCreator = new
HikariDataSourcePoolCreator();
+ DataSource dataSource =
dataSourcePoolCreator.createDataSource(createDataSourceConfiguration());
assertThat(dataSource, instanceOf(HikariDataSource.class));
HikariDataSource hikariDataSource = (HikariDataSource) dataSource;
assertThat(hikariDataSource.getDataSourceClassName(),
is("com.zaxxer.hikari.HikariDataSource"));