更改连接字符

This commit is contained in:
zhangxin10 2015-11-18 19:01:19 +08:00
parent b3abd507bd
commit eafb0b80a4
4 changed files with 27 additions and 3 deletions

View File

@ -2,5 +2,5 @@ package com.ai.cloud.skywalking.constants;
public class Constants {
public static final String spiltRegx = "^|@|#";
public static final String spiltRegx = "^~";
}

View File

@ -1,5 +1,5 @@
package com.ai.cloud.skywalking.reciever.constants;
public class Constants {
public static final String spiltRegx = "\\^\\|@\\|#";
public static final String spiltRegx = "\\^\\~";
}

View File

@ -2,7 +2,9 @@ package com.ai.cloud.skywalking.reciever.model;
import com.ai.cloud.skywalking.reciever.constants.Constants;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class BuriedPointEntry {
private String traceId;
@ -105,6 +107,26 @@ public class BuriedPointEntry {
return result;
}
private static String[] spilt(String spilt, String value) {
List<String> list = new ArrayList<String>();
int resultSize = 0;
int start = 0, offset = 0;
for (int index = 0; index < value.length() - 1; index++, offset++) {
if (spilt.charAt(0) == value.charAt(index) && spilt.charAt(1) == value.charAt(index + 1)) {
list.add(value.substring(start, offset));
index++;offset++;
start = offset + 1;
resultSize++;
}
}
if (start < value.length()) {
list.add(value.substring(start, offset));
resultSize++;
}
String[] result = new String[resultSize];
return list.subList(0, resultSize).toArray(result);
}
@Override
public String toString() {
return "BuriedPointEntry{" +

View File

@ -94,12 +94,14 @@ public class SaveToHBaseChain implements IStorageChain {
private static void bulkInsertBuriedPointData(List<BuriedPointEntry> entries) {
if (entries == null || entries.size() <= 0)
return;
List<Put> puts = new ArrayList<Put>();
Put put;
for (BuriedPointEntry buriedPointEntry : entries) {
put = new Put(Bytes.toBytes(buriedPointEntry.getTraceId()));
if (StringUtils.isEmpty(buriedPointEntry.getParentLevel().trim())) {
put.addColumn(Bytes.toBytes(Config.HBaseConfig.FAMILY_COLUMN_NAME), Bytes.toBytes(buriedPointEntry.getLevelId()),
put.addColumn(Bytes.toBytes(Config.HBaseConfig.FAMILY_COLUMN_NAME), Bytes.toBytes(String.valueOf(buriedPointEntry.getLevelId())),
Bytes.toBytes(buriedPointEntry.getOriginData()));
} else {
put.addColumn(Bytes.toBytes(Config.HBaseConfig.FAMILY_COLUMN_NAME), Bytes.toBytes(buriedPointEntry.getParentLevel()