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


Java EagleeyeHelper类代码示例

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


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

示例1: execByExecPlanNodeFuture

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
@Override
public Future<ISchematicCursor> execByExecPlanNodeFuture(final IDataNodeExecutor qc,
                                                         final ExecutionContext executionContext)
                                                                                                 throws TddlException {

    final Object rpcContext = EagleeyeHelper.getRpcContext();
    final Map<Object, Object> threadContext = ThreadLocalMap.getContextMap();
    final Map mdcContext = MDC.getCopyOfContextMap();
    ExecutorService concurrentExecutors = executionContext.getExecutorService();
    if (concurrentExecutors == null) {
        throw new ExecutorException("concurrentExecutors is null, cannot query parallelly");
    }

    Future<ISchematicCursor> task = concurrentExecutors.submit(new Callable<ISchematicCursor>() {

        @Override
        public ISchematicCursor call() throws Exception {
            ThreadLocalMap.setContextMap(resetContext(threadContext));
            EagleeyeHelper.setRpcContext(rpcContext);
            MDC.setContextMap(mdcContext);
            return execByExecPlanNode(qc, executionContext);
        }
    });
    return task;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:26,代码来源:TopologyExecutor.java

示例2: commitFuture

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
@Override
public Future<ResultCursor> commitFuture(final ExecutionContext executionContext) throws TddlException {
    final Object rpcContext = EagleeyeHelper.getRpcContext();
    final Map<Object, Object> threadContext = ThreadLocalMap.getContextMap();
    final Map mdcContext = MDC.getCopyOfContextMap();
    ExecutorService concurrentExecutors = executionContext.getExecutorService();
    if (concurrentExecutors == null) {
        throw new ExecutorException("concurrentExecutors is null, cannot query parallelly");
    }

    Future<ResultCursor> task = concurrentExecutors.submit(new Callable<ResultCursor>() {

        @Override
        public ResultCursor call() throws Exception {
            EagleeyeHelper.setRpcContext(rpcContext);
            ThreadLocalMap.setContextMap(resetContext(threadContext));
            MDC.setContextMap(mdcContext);
            return commit(executionContext);
        }
    });
    return task;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:23,代码来源:TopologyExecutor.java

示例3: rollbackFuture

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
@Override
public Future<ResultCursor> rollbackFuture(final ExecutionContext executionContext) throws TddlException {
    final Object rpcContext = EagleeyeHelper.getRpcContext();
    final Map<Object, Object> threadContext = ThreadLocalMap.getContextMap();
    final Map mdcContext = MDC.getCopyOfContextMap();
    ExecutorService concurrentExecutors = executionContext.getExecutorService();
    if (concurrentExecutors == null) {
        throw new ExecutorException("concurrentExecutors is null, cannot query parallelly");
    }

    Future<ResultCursor> task = concurrentExecutors.submit(new Callable<ResultCursor>() {

        @Override
        public ResultCursor call() throws Exception {
            EagleeyeHelper.setRpcContext(rpcContext);
            ThreadLocalMap.setContextMap(resetContext(threadContext));
            MDC.setContextMap(mdcContext);
            return rollback(executionContext);
        }
    });
    return task;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:23,代码来源:TopologyExecutor.java

示例4: buildTraceComment

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
protected String buildTraceComment() {
    StringBuilder append = new StringBuilder();
    // 添加traceId,用于mysql记录前台的sql和traceId的关联
    // 格式/* $traceId/$rpcId/$t/ */
    String traceId = EagleeyeHelper.getTraceId();
    String rpcId = EagleeyeHelper.getRpcId();
    boolean t = EagleeyeHelper.isTestMode();
    append.append("/* ");
    if (StringUtils.isNotEmpty(traceId)) {
        append.append(traceId);
    }
    append.append('/');
    if (StringUtils.isNotEmpty(rpcId)) {
        append.append(rpcId);
    }
    append.append('/');
    if (t) {
        append.append(1);
    }
    append.append("/ */");
    return append.toString();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:23,代码来源:My_JdbcHandler.java

示例5: convertToRealTable

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
private String convertToRealTable(String tableName) {
    if (tableName == null) {
        return null;
    }

    String realTableName = tableName;
    if (logicTable2RealTable != null) {
        realTableName = logicTable2RealTable.get(tableName);
    }

    // 全链路压测需求,修改为__test_xxx
    if (EagleeyeHelper.isTestMode()) {
        return EagleeyeHelper.ALL_PERF_TABLE_PREFIX + realTableName;
    } else {
        return realTableName;
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:18,代码来源:MysqlSqlVisitor.java

示例6: getTableName

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
public String getTableName() {
    // 全链路压测需求
    String t = EagleeyeHelper.getUserData("t");
    if (!StringUtils.isBlank(t) && t.equals("1")) {
        return testTableName;
    } else {
        return tableName;
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:10,代码来源:GroupSequenceDao.java

示例7: getSwitchTempTable

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
public String getSwitchTempTable() {
    String t = EagleeyeHelper.getUserData("t");
    if (!StringUtils.isBlank(t) && t.equals("1")) {
        return testSwitchTempTable;
    } else {
        return switchTempTable;
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:9,代码来源:GroupSequenceDao.java

示例8: isTestSeq

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
private boolean isTestSeq() {
    String t = EagleeyeHelper.getUserData("t");
    if (!StringUtils.isBlank(t) && t.equals("1")) {
        return true;
    } else {
        return false;
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:9,代码来源:GroupSequence.java

示例9: getOriTableName

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
public String getOriTableName() {
    // 全链路压测需求
    String t = EagleeyeHelper.getUserData("t");
    if (!StringUtils.isBlank(t) && t.equals("1")) {
        return this.testTableName;
    } else {
        return this.tableName;
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:10,代码来源:UnitGroupSequenceDao.java

示例10: getSwitchTableName

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
public String getSwitchTableName() {
    // 全链路压测需求
    String t = EagleeyeHelper.getUserData("t");
    if (!StringUtils.isBlank(t) && t.equals("1")) {
        return this.testSwitchTempTable;
    } else {
        return this.switchTempTable;
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:10,代码来源:UnitGroupSequenceDao.java

示例11: execByExecPlanNodesFuture

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
@Override
public Future<List<ISchematicCursor>> execByExecPlanNodesFuture(final List<IDataNodeExecutor> qcs,
                                                                final ExecutionContext executionContext)
                                                                                                        throws TddlException {
    final Object rpcContext = EagleeyeHelper.getRpcContext();
    final Map<Object, Object> threadContext = ThreadLocalMap.getContextMap();
    final Map mdcContext = MDC.getCopyOfContextMap();
    ExecutorService concurrentExecutors = executionContext.getExecutorService();
    if (concurrentExecutors == null) {
        throw new ExecutorException("concurrentExecutors is null, cannot query parallelly");
    }

    Future<List<ISchematicCursor>> task = concurrentExecutors.submit(new Callable<List<ISchematicCursor>>() {

        @Override
        public List<ISchematicCursor> call() throws Exception {
            List<ISchematicCursor> cursors = new ArrayList(qcs.size());
            EagleeyeHelper.setRpcContext(rpcContext);
            ThreadLocalMap.setContextMap(resetContext(threadContext));
            MDC.setContextMap(mdcContext);
            for (IDataNodeExecutor qc : qcs) {
                cursors.add(execByExecPlanNode(qc, executionContext));
            }

            return cursors;
        }
    });
    return task;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:30,代码来源:TopologyExecutor.java

示例12: parse

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
private ParserResult parse(String sql) throws SQLSyntaxErrorException {
    ParserResult result = new ParserResult();
    SQLStatement statement = SQLParserDelegate.parse(sql);
    result.statement = statement;

    StringBuilder appendable = new StringBuilder();
    MysqlParameterizedSqlVistor visitor = new MysqlParameterizedSqlVistor(appendable, true);
    statement.accept(visitor);
    result.parameterizedSql = visitor.getSql();
    // 和eagleEye约定,加上!前缀
    result.index = EagleeyeHelper.index("!" + result.parameterizedSql);
    return result;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:14,代码来源:CobarSqlParseManager.java

示例13: startRpc

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
protected void startRpc(String sqlType) {
    if (sqlMetaData != null) {
        EagleeyeHelper.startRpc(datasourceWrapper.runTimeConf.getIp(),
            datasourceWrapper.runTimeConf.getPort(),
            datasourceWrapper.runTimeConf.getDbName(),
            sqlType);
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:9,代码来源:TStatementWrapper.java

示例14: visit

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
@Override
public void visit(IQuery query) {
    if (query.isSubQuery() && !query.isTopQuery()) {
        sqlBuilder.append(" ( ");
    }
    if (query.isSubQuery() || query.isTopQuery()) {
        buildSelect(query);

        if (query.getTableName() == null && query.getSubQuery() == null) {
            return;
        }
        sqlBuilder.append(" from ");
    }

    if (query.getTableName() != null) {

        if (EagleeyeHelper.isTestMode()) {
            sqlBuilder.append(EagleeyeHelper.ALL_PERF_TABLE_PREFIX);
        }
        sqlBuilder.append(query.getTableName());

        if (!query.isSubQuery() && query.getAlias() != null
            && !query.getAlias().equalsIgnoreCase(query.getTableName())) {
            sqlBuilder.append(" ").append(query.getAlias());
        }
    } else if (query.getSubQuery() != null) {
        sqlBuilder.append(this.getNewVisitor(query.getSubQuery(), query.getSubQuery()).getString());
    }

    if (query.isSubQuery() || query.isTopQuery()) {
        String keyFilterStr = "";

        IFilter whereFilter = FilterUtils.and(FilterUtils.and(query.getKeyFilter(), query.getValueFilter()),
            query.getOtherJoinOnFilter());

        if (whereFilter != null) {
            MysqlPlanVisitorImpl visitor = this.getNewVisitor(whereFilter);
            keyFilterStr = visitor.getString();
        }

        if (!TStringUtil.isEmpty(keyFilterStr)) {
            sqlBuilder.append(" where ");
            sqlBuilder.append(keyFilterStr);
        }
        buildGroupBy(query);
        buildHaving(query);
        buildOrderBy(query);
        buildLimit(query);

        switch (query.getLockMode()) {
            case EXCLUSIVE_LOCK:
                sqlBuilder.append(" FOR UPDATE");
                break;
            case SHARED_LOCK:
                sqlBuilder.append(" LOCK IN SHARE MODE");
                break;
            default:
                break;
        }
    }

    if (query.isSubQuery() && !query.isTopQuery()) {
        sqlBuilder.append(" ) ");
        if (query.getAlias() != null) {
            sqlBuilder.append(" ").append(query.getAlias()).append(" ");
        }
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:69,代码来源:MysqlPlanVisitorImpl.java

示例15: endRpc

import com.taobao.tddl.monitor.eagleeye.EagleeyeHelper; //导入依赖的package包/类
protected void endRpc(String sql, Exception e) {
    if (sqlMetaData != null) {
        EagleeyeHelper.endRpc(sqlMetaData, e);
    }
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:6,代码来源:TStatementWrapper.java


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