本文整理汇总了Java中com.taobao.tddl.repo.oceanbase.handler.ObCommandHandlerFactory类的典型用法代码示例。如果您正苦于以下问题:Java ObCommandHandlerFactory类的具体用法?Java ObCommandHandlerFactory怎么用?Java ObCommandHandlerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObCommandHandlerFactory类属于com.taobao.tddl.repo.oceanbase.handler包,在下文中一共展示了ObCommandHandlerFactory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInit
import com.taobao.tddl.repo.oceanbase.handler.ObCommandHandlerFactory; //导入依赖的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 ObCursorFactory();
cef = new ObCommandHandlerFactory();
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);
Ob_Table table = new Ob_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 {
OceanbaseDataSourceProxy obDS = new OceanbaseDataSourceProxy();
String configUrl = group.getProperties().get(CONFIG_URL);
if (configUrl == null) {
throw new IllegalArgumentException("config url is not assigned, oceanbase datasource cannot be inited");
}
obDS.setConfigURL(configUrl);
obDS.init();
ObGroupExecutor executor = new ObGroupExecutor(getRepo());
executor.setGroup(group);
executor.setGroupDataSource(new OBDataSourceWrapper(obDS));
return executor;
}
});
}
示例2: doInit
import com.taobao.tddl.repo.oceanbase.handler.ObCommandHandlerFactory; //导入依赖的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 ObCursorFactory();
cef = new ObCommandHandlerFactory();
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);
Ob_Table table = new Ob_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 {
OceanbaseDataSourceProxy obDS = new OceanbaseDataSourceProxy();
String configUrl = group.getProperties().get(CONFIG_URL);
if (configUrl == null) {
throw new TddlRuntimeException("config url is not assigned, oceanbase datasource cannot be inited");
}
obDS.setConfigURL(configUrl);
obDS.init();
TddlGroupExecutor executor = new TddlGroupExecutor(getRepo());
executor.setGroup(group);
executor.setRemotingExecutableObject(obDS);
return executor;
}
});
}