Commit 7be08f88 by huluobin

update

parent 23b1d38f
package com.bailuntec.support;
import com.alibaba.druid.pool.DruidDataSource;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.ibatis.datasource.DataSourceFactory;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Properties;
public class DruidDataSourceFactory implements DataSourceFactory {
private Properties props;
@Override
public void setProperties(Properties props) {
this.props = props;
......@@ -16,17 +17,12 @@ public class DruidDataSourceFactory implements DataSourceFactory {
@Override
public DataSource getDataSource() {
DruidDataSource dds = new DruidDataSource();
dds.setDriverClassName(this.props.getProperty("driver"));
dds.setUrl(this.props.getProperty("url"));
dds.setUsername(this.props.getProperty("username"));
dds.setPassword(this.props.getProperty("password"));
// 其他配置可以根据MyBatis主配置文件进行配置
try {
dds.init();
} catch (SQLException e) {
e.printStackTrace();
}
return dds;
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName(this.props.getProperty("driver"));
hikariConfig.setJdbcUrl(this.props.getProperty("url"));
hikariConfig.setUsername(this.props.getProperty("username"));
hikariConfig.setPassword(this.props.getProperty("password"));
return new HikariDataSource(hikariConfig);
}
}
......@@ -5,8 +5,8 @@
<configuration>
<!--<properties resource="db-tj.properties"/>-->
<properties resource="db-dev.properties"/>
<!-- <properties resource="db-prod.properties"/>-->
<properties resource="db-dev.properties"/>
<!-- <properties resource="db-prod.properties"/>-->
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
......
......@@ -20,6 +20,6 @@ JOB_CRON_NE_NORMAL=0 0 1 ? * MON
JOB_NAME_INCREMENT=show-auto-turnover-increment
JOB_CRON_INCREMENT=0 0 14 * * ?
JOB_CRON_INCREMENT=0 52 17 * * ?
SHARDING_TOTAL_COUNT_INCREMENT=8
......@@ -57,7 +57,7 @@ public class AutoTurnoverJobTest {
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 0),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 0),
jobPointLog);
}
......@@ -68,7 +68,7 @@ public class AutoTurnoverJobTest {
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 1),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 1),
jobPointLog);
}
......@@ -79,7 +79,7 @@ public class AutoTurnoverJobTest {
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 2),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 2),
jobPointLog);
}
......@@ -90,7 +90,7 @@ public class AutoTurnoverJobTest {
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 3),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 3),
jobPointLog);
}
......@@ -101,7 +101,7 @@ public class AutoTurnoverJobTest {
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 4),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 4),
jobPointLog);
}
......@@ -112,7 +112,7 @@ public class AutoTurnoverJobTest {
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 5),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 5),
jobPointLog);
}
......@@ -123,29 +123,32 @@ public class AutoTurnoverJobTest {
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 6),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 6),
jobPointLog);
}
@Test
public void syncAll7() {
JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setPageIndex(2);
jobPointLog.setPageIndex(1);
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "NORMAL", new HashMap<>()), 7),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 7),
jobPointLog);
}
@Test
public void syncAll7_1() {
public void sync7_1() {
JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setPageIndex(1);
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.jobInit(new ShardingContext(new ShardingContexts("x", "show-auto-turnover2", 8, "NORMAL", new HashMap<>()), 7));
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", "show-auto-turnover3", 1, "INCREMENT", new HashMap<>()), 0),
jobPointLog);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment