当前位置: 首页>>代码示例>>Java>>正文


Java ObCommandHandlerFactory类代码示例

本文整理汇总了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;
        }
    });
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:53,代码来源:Ob_Repository.java

示例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;
        }
    });
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:52,代码来源:Ob_Repository.java


注:本文中的com.taobao.tddl.repo.oceanbase.handler.ObCommandHandlerFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。