Commit 410680a6 authored by tristaZero's avatar tristaZero
Browse files

modify rewrite function

parent 81eea3b4
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -67,18 +67,15 @@ public final class ShardingContext implements AutoCloseable {
    
    private Collection<String> circuitBreakerDataSourceNames = new LinkedList<>();
    
    public ShardingContext(final Map<String, DataSource> dataSourceMap, final ShardingRule shardingRule, final DatabaseType databaseType, final ShardingExecuteEngine executeEngine,
                           final ConnectionMode connectionMode, final boolean showSQL) {
        init(dataSourceMap, shardingRule, databaseType, executeEngine, connectionMode, showSQL);
    public ShardingContext(final Map<String, DataSource> dataSourceMap, final ShardingRule shardingRule, final DatabaseType databaseType, final ShardingExecuteEngine executeEngine, final boolean showSQL) {
        init(dataSourceMap, shardingRule, databaseType, executeEngine, showSQL);
    }
    
    private void init(final Map<String, DataSource> dataSourceMap, final ShardingRule shardingRule, final DatabaseType databaseType, final ShardingExecuteEngine executeEngine,
                      final ConnectionMode connectionMode, final boolean showSQL) {
    private void init(final Map<String, DataSource> dataSourceMap, final ShardingRule shardingRule, final DatabaseType databaseType, final ShardingExecuteEngine executeEngine, final boolean showSQL) {
        this.dataSourceMap = dataSourceMap;
        this.shardingRule = shardingRule;
        this.executeEngine = executeEngine;
        this.databaseType = databaseType;
        this.connectionMode = connectionMode;
        this.showSQL = showSQL;
        metaData = new ShardingMetaData(
                getDataSourceURLs(getDataSourceMap()), shardingRule, getDatabaseType(), executeEngine, new JDBCTableMetaDataConnectionManager(getDataSourceMap()));
@@ -91,13 +88,11 @@ public final class ShardingContext implements AutoCloseable {
     * @param shardingRule sharding rule
     * @param databaseType data type
     * @param executeEngine sharding executor engine
     * @param connectionMode connection mode
     * @param showSQL show sql
     */
    public void renew(final Map<String, DataSource> dataSourceMap, final ShardingRule shardingRule, final DatabaseType databaseType, final ShardingExecuteEngine executeEngine,
                      final ConnectionMode connectionMode, final boolean showSQL) {
    public void renew(final Map<String, DataSource> dataSourceMap, final ShardingRule shardingRule, final DatabaseType databaseType, final ShardingExecuteEngine executeEngine, final boolean showSQL) {
        close();
        init(dataSourceMap, shardingRule, databaseType, executeEngine, connectionMode, showSQL);
        init(dataSourceMap, shardingRule, databaseType, executeEngine, showSQL);
    }
    
    /**