提交 17606659 编写于 作者: Z zhang.xin

1.修改类名

2. 修改方法名
上级 a5f9b30f
......@@ -2,7 +2,7 @@ package com.ai.cloud.skywalking.analysis.chainbuild;
import com.ai.cloud.skywalking.analysis.chainbuild.entity.CallChainTree;
import com.ai.cloud.skywalking.analysis.chainbuild.po.ChainInfo;
import com.ai.cloud.skywalking.analysis.chainbuild.po.SpecificTimeCallChainTreeMergedChainIdContainer;
import com.ai.cloud.skywalking.analysis.chainbuild.po.SpecificTimeCallTreeMergedChainIdContainer;
import com.ai.cloud.skywalking.analysis.config.ConfigInitializer;
import com.google.gson.Gson;
import org.apache.hadoop.hbase.util.Bytes;
......@@ -33,7 +33,7 @@ public class ChainBuildReducer extends Reducer<Text, Text, Text, IntWritable> {
public void doReduceAction(String key, Iterator<Text> chainInfoIterator)
throws IOException, InterruptedException {
CallChainTree chainTree = CallChainTree.load(key);
SpecificTimeCallChainTreeMergedChainIdContainer container = new SpecificTimeCallChainTreeMergedChainIdContainer(chainTree.getTreeToken());
SpecificTimeCallTreeMergedChainIdContainer container = new SpecificTimeCallTreeMergedChainIdContainer(chainTree.getTreeToken());
while (chainInfoIterator.hasNext()) {
String callChainData = chainInfoIterator.next().toString();
ChainInfo chainInfo = null;
......
......@@ -8,7 +8,7 @@ import org.apache.hadoop.hbase.client.Put;
import java.io.IOException;
import java.util.*;
public class SpecificTimeCallChainTreeMergedChainIdContainer {
public class SpecificTimeCallTreeMergedChainIdContainer {
private String treeToken;
......@@ -17,7 +17,7 @@ public class SpecificTimeCallChainTreeMergedChainIdContainer {
// 本次Reduce合并过的调用链
private Map<String, ChainInfo> combineChains;
public SpecificTimeCallChainTreeMergedChainIdContainer(String treeToken) {
public SpecificTimeCallTreeMergedChainIdContainer(String treeToken) {
this.treeToken = treeToken;
hasBeenMergedChainIds = new HashMap<String, List<String>>();
combineChains = new HashMap<String, ChainInfo>();
......@@ -45,14 +45,11 @@ public class SpecificTimeCallChainTreeMergedChainIdContainer {
}
public void saveToHBase() throws IOException, InterruptedException {
List<Put> chainInfoPuts = new ArrayList<Put>();
for (Map.Entry<String, ChainInfo> entry : combineChains.entrySet()) {
Put put = new Put(entry.getKey().getBytes());
entry.getValue().saveToHBase(put);
chainInfoPuts.add(put);
}
HBaseUtil.batchSaveChainInfo(chainInfoPuts);
batchSaveCurrentHasBeenMergedChainInfo();
batchSaveMergedChainId();
}
private void batchSaveMergedChainId() throws IOException, InterruptedException {
List<Put> chainIdPuts = new ArrayList<Put>();
for (Map.Entry<String, List<String>> entry : hasBeenMergedChainIds.entrySet()) {
Put chainIdPut = new Put(entry.getKey().getBytes());
......@@ -63,4 +60,14 @@ public class SpecificTimeCallChainTreeMergedChainIdContainer {
HBaseUtil.batchSaveHasBeenMergedCID(chainIdPuts);
}
private void batchSaveCurrentHasBeenMergedChainInfo() throws IOException, InterruptedException {
List<Put> chainInfoPuts = new ArrayList<Put>();
for (Map.Entry<String, ChainInfo> entry : combineChains.entrySet()) {
Put put = new Put(entry.getKey().getBytes());
entry.getValue().saveToHBase(put);
chainInfoPuts.add(put);
}
HBaseUtil.batchSaveChainInfo(chainInfoPuts);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册