本文整理汇总了Java中com.taobao.tddl.repo.mysql.handler.CommandHandlerFactoryMyImp类的典型用法代码示例。如果您正苦于以下问题:Java CommandHandlerFactoryMyImp类的具体用法?Java CommandHandlerFactoryMyImp怎么用?Java CommandHandlerFactoryMyImp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommandHandlerFactoryMyImp类属于com.taobao.tddl.repo.mysql.handler包,在下文中一共展示了CommandHandlerFactoryMyImp类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInit
import com.taobao.tddl.repo.mysql.handler.CommandHandlerFactoryMyImp; //导入依赖的package包/类
@Override
public void doInit() {
this.config = new RepositoryConfig();
this.config.setProperty(RepositoryConfig.DEFAULT_TXN_ISOLATION, "READ_COMMITTED");
this.config.setProperty(RepositoryConfig.IS_TRANSACTIONAL, "true");
cfm = new CursorFactoryMyImpl();
cef = new CommandHandlerFactoryMyImp();
tables = CacheBuilder.newBuilder().build(new CacheLoader<String, LoadingCache<TableMeta, ITable>>() {
@Override
public LoadingCache<TableMeta, ITable> load(final String groupNode) throws Exception {
return CacheBuilder.newBuilder().build(new CacheLoader<TableMeta, ITable>() {
@Override
public ITable load(TableMeta meta) throws Exception {
try {
DataSource ds = dsGetter.getDataSource(groupNode);
My_Table table = new My_Table(ds, meta, groupNode);
table.setSelect(false);
return table;
} catch (Exception ex) {
throw new TddlNestableRuntimeException(ex);
}
}
});
}
});
executors = CacheBuilder.newBuilder().build(new CacheLoader<Group, IGroupExecutor>() {
@Override
public IGroupExecutor load(Group group) throws Exception {
TGroupDataSource groupDS = new TGroupDataSource(group.getName(), group.getAppName());
groupDS.setUnitName(group.getUnitName());
groupDS.init();
TddlGroupExecutor executor = new TddlGroupExecutor(getRepo());
executor.setGroup(group);
executor.setGroupDataSource(groupDS);
executor.init();
return executor;
}
});
}
示例2: doInit
import com.taobao.tddl.repo.mysql.handler.CommandHandlerFactoryMyImp; //导入依赖的package包/类
@Override
public void doInit() {
this.config = new RepositoryConfig();
this.config.setProperty(RepositoryConfig.DEFAULT_TXN_ISOLATION, "READ_COMMITTED");
this.config.setProperty(RepositoryConfig.IS_TRANSACTIONAL, "true");
cfm = new CursorFactoryMyImpl();
cef = new CommandHandlerFactoryMyImp();
tables = CacheBuilder.newBuilder().build(new CacheLoader<String, LoadingCache<TableMeta, ITable>>() {
@Override
public LoadingCache<TableMeta, ITable> load(final String groupNode) throws Exception {
return CacheBuilder.newBuilder().build(new CacheLoader<TableMeta, ITable>() {
@Override
public ITable load(TableMeta meta) throws Exception {
try {
DataSource ds = dsGetter.getDataSource(groupNode);
My_Table table = new My_Table(ds, meta, groupNode);
table.setSelect(false);
return table;
} catch (Exception ex) {
throw new TddlException(ExceptionErrorCodeUtils.Read_only, ex);
}
}
});
}
});
executors = CacheBuilder.newBuilder().build(new CacheLoader<Group, IGroupExecutor>() {
@Override
public IGroupExecutor load(Group group) throws Exception {
TGroupDataSource groupDS = new TGroupDataSource(group.getName(), group.getAppName());
groupDS.init();
TddlGroupExecutor executor = new TddlGroupExecutor(getRepo());
executor.setGroup(group);
executor.setRemotingExecutableObject(groupDS);
return executor;
}
});
}