提交 2bc6bfbf 编写于 作者: C cherrylzhao

refactor raw-jdbc-orche-example.

上级 e19e5d69
......@@ -28,14 +28,14 @@ import java.sql.SQLException;
*/
public class JavaConfigurationTransactionExample {
private static ShardingType type = ShardingType.SHARDING_DATABASES;
// private static ShardingType type = ShardingType.SHARDING_TABLES;
// private static ShardingType type = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType type = ShardingType.MASTER_SLAVE;
// private static ShardingType type = ShardingType.SHARDING_MASTER_SLAVE;
private static ShardingType shardingType = ShardingType.SHARDING_DATABASES;
// private static ShardingType shardingType = ShardingType.SHARDING_TABLES;
// private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType shardingType = ShardingType.MASTER_SLAVE;
// private static ShardingType shardingType = ShardingType.SHARDING_MASTER_SLAVE;
public static void main(final String[] args) throws SQLException {
TransactionService transactionService = CommonTransactionServiceFactory.newInstance(type);
TransactionService transactionService = CommonTransactionServiceFactory.newInstance(shardingType);
transactionService.initEnvironment();
transactionService.processSuccessWithLocal();
transactionService.processSuccessWithXA();
......
......@@ -29,14 +29,14 @@ import java.sql.SQLException;
*/
public class YamlConfigurationExample {
private static ShardingType type = ShardingType.SHARDING_DATABASES;
// private static ShardingType type = ShardingType.SHARDING_TABLES;
// private static ShardingType type = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType type = ShardingType.MASTER_SLAVE;
// private static ShardingType type = ShardingType.SHARDING_MASTER_SLAVE;
private static ShardingType shardingType = ShardingType.SHARDING_DATABASES;
// private static ShardingType shardingType = ShardingType.SHARDING_TABLES;
// private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType shardingType = ShardingType.MASTER_SLAVE;
// private static ShardingType shardingType = ShardingType.SHARDING_MASTER_SLAVE;
public static void main(final String[] args) throws SQLException, IOException {
CommonService commonService = YamlCommonServiceFactory.newInstance(type);
CommonService commonService = YamlCommonServiceFactory.newInstance(shardingType);
commonService.initEnvironment();
commonService.processSuccess();
commonService.cleanEnvironment();
......
......@@ -29,14 +29,14 @@ import java.sql.SQLException;
*/
public class YamlConfigurationTransactionExample {
private static ShardingType type = ShardingType.SHARDING_DATABASES;
// private static ShardingType type = ShardingType.SHARDING_TABLES;
// private static ShardingType type = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType type = ShardingType.MASTER_SLAVE;
// private static ShardingType type = ShardingType.SHARDING_MASTER_SLAVE;
private static ShardingType shardingType = ShardingType.SHARDING_DATABASES;
// private static ShardingType shardingType = ShardingType.SHARDING_TABLES;
// private static ShardingType shardingType = ShardingType.SHARDING_DATABASES_AND_TABLES;
// private static ShardingType shardingType = ShardingType.MASTER_SLAVE;
// private static ShardingType shardingType = ShardingType.SHARDING_MASTER_SLAVE;
public static void main(final String[] args) throws SQLException, IOException {
TransactionService transactionService = YamlCommonTransactionServiceFactory.newInstance(type);
TransactionService transactionService = YamlCommonTransactionServiceFactory.newInstance(shardingType);
transactionService.initEnvironment();
transactionService.processSuccessWithLocal();
transactionService.processSuccessWithXA();
......
......@@ -44,7 +44,8 @@ public class JavaConfigurationExample {
public static void main(final String[] args) throws Exception {
CommonService commonService = CommonServiceFactory.newInstance(shardingType, registryCenterType, loadConfigFromRegCenter);
CommonServiceScenario scenario = new CommonServiceScenario(commonService);
scenario.process();
commonService.initEnvironment();
commonService.processSuccess();
commonService.cleanEnvironment();
}
}
......@@ -44,7 +44,11 @@ public class JavaConfigurationTransactionExample {
public static void main(final String[] args) throws Exception {
TransactionService transactionService = CommonTransactionServiceFactory.newInstance(shardingType, registryCenterType, loadConfigFromRegCenter);
TransactionServiceScenario scenario = new TransactionServiceScenario(transactionService);
scenario.process();
transactionService.initEnvironment();
transactionService.processSuccessWithLocal();
transactionService.processSuccessWithXA();
transactionService.processFailureWithLocal();
transactionService.processFailureWithXA();
transactionService.cleanEnvironment();
}
}
......@@ -18,7 +18,6 @@
package io.shardingsphere.example.jdbc.orche;
import io.shardingsphere.example.jdbc.orche.factory.YamlCommonServiceFactory;
import io.shardingsphere.example.repository.api.senario.CommonServiceScenario;
import io.shardingsphere.example.repository.api.service.CommonService;
import io.shardingsphere.example.type.RegistryCenterType;
import io.shardingsphere.example.type.ShardingType;
......@@ -44,7 +43,8 @@ public class YamlConfigurationExample {
public static void main(final String[] args) throws Exception {
CommonService commonService = YamlCommonServiceFactory.newInstance(shardingType, registryCenterType, loadConfigFromRegCenter);
CommonServiceScenario scenario = new CommonServiceScenario(commonService);
scenario.process();
commonService.initEnvironment();
commonService.processSuccess();
commonService.cleanEnvironment();
}
}
......@@ -44,7 +44,11 @@ public class YamlConfigurationTransactionExample {
public static void main(final String[] args) throws Exception {
TransactionService transactionService = YamlCommonTransactionServiceFactory.newInstance(shardingType, registryCenterType, loadConfigFromRegCenter);
TransactionServiceScenario scenario = new TransactionServiceScenario(transactionService);
scenario.process();
transactionService.initEnvironment();
transactionService.processSuccessWithLocal();
transactionService.processSuccessWithXA();
transactionService.processFailureWithLocal();
transactionService.processFailureWithXA();
transactionService.cleanEnvironment();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册