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


Java ITable类代码示例

本文整理汇总了Java中com.taobao.tddl.executor.spi.ITable的典型用法代码示例。如果您正苦于以下问题:Java ITable类的具体用法?Java ITable怎么用?Java ITable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ITable类属于com.taobao.tddl.executor.spi包,在下文中一共展示了ITable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
public ISchematicCursor handle(IDataNodeExecutor executor, ExecutionContext executionContext) throws TddlException {
    long time = System.currentTimeMillis();
    IPut put = (IPut) executor;
    My_JdbcHandler jdbcHandler = ((My_Repository) executionContext.getCurrentRepository()).getJdbcHandler(dsGetter,
        executor,
        executionContext);
    TableAndIndex ti = new TableAndIndex();

    buildTableAndMeta(put, ti, executionContext);
    ITable table = ti.table;
    IndexMeta meta = ti.index;

    ISchematicCursor result = null;
    try {
        result = executePut(executionContext, put, table, meta, jdbcHandler);
    } catch (Exception e) {
        time = Monitor.monitorAndRenewTime(Monitor.KEY1, Monitor.KEY2_TDDL_EXECUTE, Monitor.Key3Fail, time);
        throw new TddlException(e);
    }
    time = Monitor.monitorAndRenewTime(Monitor.KEY1, Monitor.KEY2_TDDL_EXECUTE, Monitor.Key3Success, time);
    return result;

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:25,代码来源:PutMyHandlerCommon.java

示例2: getTable

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
public ITable getTable(TableMeta table_schema, String groupNode, String actualTableName) throws TddlException {
    ITable table = tables.get(table_schema.getTableName());
    if (table == null) {
        synchronized (this) {
            table = tables.get(table_schema.getTableName());
            if (table == null) {
                try {
                    table = initTable(table_schema);
                } catch (ReplicaWriteException ex) {
                    throw new TddlNestableRuntimeException(ex);
                }
                if (!table_schema.isTmp()) {
                    tables.put(table_schema.getTableName(), table);
                }
            }

        }
    }
    return table;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:22,代码来源:JE_Repository.java

示例3: getTable

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
public ITable getTable(TableMeta table_schema, String groupNode) throws TddlException {
    ITable table = tables.get(table_schema.getTableName());
    if (table == null) {
        synchronized (this) {
            table = tables.get(table_schema.getTableName());
            if (table == null) {
                try {
                    table = initTable(table_schema);
                } catch (ReplicaWriteException ex) {
                    throw new TddlException(ExceptionErrorCodeUtils.Read_only, ex);
                }
                if (!table_schema.isTmp()) {
                    tables.put(table_schema.getTableName(), table);
                }
            }

        }
    }
    return table;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:22,代码来源:JE_Repository.java

示例4: manageToReverseIndex

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
protected ISchematicCursor manageToReverseIndex(ExecutionContext executionContext, ISchematicCursor cursor,
                                                IDataNodeExecutor executor, IRepository repo,
                                                ITransaction transaction, ITable table, IndexMeta meta,
                                                IFilter keyFilter) throws TddlException {
    throw new IllegalArgumentException("should not be here");

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:8,代码来源:QueryHandler.java

示例5: handle

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
public ISchematicCursor handle(IDataNodeExecutor executor, ExecutionContext executionContext) throws TddlException {

    if (executionContext.getParams() != null && executionContext.getParams().isBatch()) {
        throw new ExecutorException("batch is not supported for :"
                                    + executionContext.getCurrentRepository().getClass());
    }

    long time = System.currentTimeMillis();
    IPut put = (IPut) executor;
    TableAndIndex ti = new TableAndIndex();
    buildTableAndMeta(put, ti, executionContext);

    int affect_rows = 0;
    ITransaction transaction = executionContext.getTransaction();
    ITable table = ti.table;
    IndexMeta meta = ti.index;

    try {
        if (transaction == null) {// 客户端没有用事务,这里手动加上。
            throw new IllegalAccessError("txn is null");
        }
        affect_rows = executePut(executionContext, put, table, meta);
    } catch (Exception e) {
        time = Monitor.monitorAndRenewTime(Monitor.KEY1, Monitor.KEY2_TDDL_EXECUTE, Monitor.Key3Fail, time);
        throw new TddlNestableRuntimeException(e);
    }

    // 这里返回key->value的方式的东西,类似Key=affectRow val=1 这样的软编码
    IAffectRowCursor affectrowCursor = executionContext.getCurrentRepository()
        .getCursorFactory()
        .affectRowCursor(executionContext, affect_rows);

    time = Monitor.monitorAndRenewTime(Monitor.KEY1, Monitor.KEY2_TDDL_EXECUTE, Monitor.Key3Success, time);
    return affectrowCursor;

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:38,代码来源:PutHandlerCommon.java

示例6: cleanTempTables

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
public void cleanTempTables() {
    for (ITable tempTable : getTempTables().asMap().values()) {
        try {
            tempTable.close();
        } catch (Throwable e) {
            logger.warn("temp table close failed", e);
        }
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:10,代码来源:ExecutionContext.java

示例7: getTable

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
public ITable getTable(final TableMeta meta, final String groupNode, String actualTableName) throws TddlException {
    if (meta.isTmp()) {
        return getTempTable(meta);
    } else {
        try {
            return tables.get(groupNode).get(meta);
        } catch (ExecutionException e) {
            throw new TddlNestableRuntimeException(e);
        }
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:13,代码来源:My_Repository.java

示例8: executePut

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
protected ISchematicCursor executePut(ExecutionContext executionContext, IPut put, ITable table, IndexMeta meta,
                                      My_JdbcHandler myJdbcHandler) throws TddlException {
    try {
        return myJdbcHandler.executeUpdate(executionContext, put, table, meta);
    } catch (SQLException e) {
        throw new TddlException(e);
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:10,代码来源:InsertMyHandler.java

示例9: executePut

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
protected ISchematicCursor executePut(ExecutionContext executionContext, IPut put, ITable table, IndexMeta meta,
                                      My_JdbcHandler myJdbcHandler) throws TddlException {
    try {
        return myJdbcHandler.executeUpdate(executionContext, put, table, meta);
    } catch (SQLException e) {
        throw new TddlException(e);
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:11,代码来源:UpdateMyHandler.java

示例10: doDestroy

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
public void doDestroy() throws TddlException {
    for (Entry<String, ITable> t : tables.entrySet()) {
        t.getValue().close();
    }
    env.close();
    if (env_tmp != null) {
        env_tmp.close();
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:11,代码来源:JE_Repository.java

示例11: getTable

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
public ITable getTable(TableMeta meta, String groupNode, String actualTableName) throws TddlException {
    DemoTable table = null;
    table = dbMap.get(actualTableName);
    if (table == null) {
        table = new DemoTable(meta);
        dbMap.put(actualTableName, table);
    }

    return table;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:12,代码来源:DemoRepository.java

示例12: doInit

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
public void doInit() {

    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 {
                        HbTable table = new HbTable(meta, groupNameAndExecutors.get(groupNode)
                            .getRemotingExecutableObject(), physicalSchema.get(meta.getTableName()));
                        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 {

            HBaseGroupExecutor executor = new HBaseGroupExecutor(getRepo());
            group.getProperties().put(HbaseConf.cluster_name, group.getName());
            executor.setGroup(group);
            executor.setHbOperate(getHBCluster(group.getProperties()));

            groupNameAndExecutors.put(group.getName(), executor);

            return executor;
        }
    });
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:41,代码来源:HbRepository.java

示例13: executePut

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@Override
protected int executePut(ExecutionContext executionContext, IPut put, ITable table, IndexMeta meta)
                                                                                                   throws Exception {
    int affect_rows = 0;
    IPut delete = put;
    ISchematicCursor conditionCursor = null;
    conditionCursor = ExecutorContext.getContext()
        .getTopologyExecutor()
        .execByExecPlanNode(put.getQueryTree(), executionContext);
    IRowSet rowSet = null;
    try {
        while ((rowSet = conditionCursor.next()) != null) {
            affect_rows++;
            CloneableRecord key = ExecUtils.convertToClonableRecord(rowSet);
            // prepare(transaction, table, rowSet, null, null,
            // PUT_TYPE.DELETE);
            table.delete(null, key, meta, put.getTableName());
        }
    } catch (Exception e) {
        throw e;
    } finally {
        List<TddlException> exs = conditionCursor.close(null);

        if (!exs.isEmpty()) throw GeneralUtil.mergeException(exs);
    }

    return affect_rows;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:29,代码来源:HbDeleteHandler.java

示例14: executePut

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
protected int executePut(ExecutionContext executionContext, IPut put, ITable table, IndexMeta meta)
                                                                                                   throws Exception {
    ITransaction transaction = executionContext.getTransaction();
    int affect_rows = 0;
    IPut delete = put;
    ISchematicCursor conditionCursor = null;
    IRowSet rowSet = null;
    CloneableRecord key = CodecFactory.getInstance(CodecFactory.FIXED_LENGTH)
        .getCodec(meta.getKeyColumns())
        .newEmptyRecord();
    try {
        conditionCursor = ExecutorContext.getContext()
            .getTopologyExecutor()
            .execByExecPlanNode(delete.getQueryTree(), executionContext);
        while ((rowSet = conditionCursor.next()) != null) {
            affect_rows++;
            for (ColumnMeta cm : meta.getKeyColumns()) {
                Object val = getValByColumnMeta(rowSet, cm);
                key.put(cm.getName(), val);
            }
            // CloneableRecord key =
            // ExecUtils.convertToClonableRecord(rowSet);
            prepare(transaction, table, rowSet, null, null, PUT_TYPE.DELETE);
            table.delete(executionContext, key, meta, put.getTableName());
        }
    } catch (Exception e) {
        throw e;
    } finally {
        if (conditionCursor != null) {
            List<TddlException> exs = new ArrayList();
            exs = conditionCursor.close(exs);
            if (!exs.isEmpty()) {
                throw GeneralUtil.mergeException(exs);
            }
        }
    }
    return affect_rows;
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:41,代码来源:DeleteHandler.java

示例15: prepare

import com.taobao.tddl.executor.spi.ITable; //导入依赖的package包/类
protected void prepare(ITransaction transaction, ITable table, IRowSet oldkv, CloneableRecord key,
                       CloneableRecord value, IPut.PUT_TYPE putType) throws TddlException {
    ITHLog historyLog = transaction.getHistoryLog();
    if (historyLog != null) {
        historyLog.parepare(transaction.getId(), table.getSchema(), putType, oldkv, new KVPair(key, value));
    }
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:8,代码来源:PutHandlerCommon.java


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