提交 f9fe2d4d 编写于 作者: wu-sheng's avatar wu-sheng

移动BufferPool代码位置,增加可读性。

上级 81a8aabc
package com.ai.cloud.skywalking.buffer;
import com.ai.cloud.skywalking.protocol.common.ISerializable;
import java.util.concurrent.ThreadLocalRandom;
import static com.ai.cloud.skywalking.conf.Config.Buffer.POOL_SIZE;
/**
* Created by wusheng on 16/7/21.
*/
class BufferPool {
// 注意: 这个变量名如果改变需要改变test-api工程中的Config变量
private static BufferGroup[] bufferGroups = new BufferGroup[POOL_SIZE];
static {
for (int i = 0; i < POOL_SIZE; i++) {
bufferGroups[i] = new BufferGroup("buffer_group-" + i);
}
}
public void save(ISerializable data) {
bufferGroups[ThreadLocalRandom.current().nextInt(0, POOL_SIZE)].save(data);
}
}
......@@ -25,22 +25,6 @@ public class ContextBuffer {
logger.error("save span error.", t);
}
}
static class BufferPool {
// 注意: 这个变量名如果改变需要改变test-api工程中的Config变量
private static BufferGroup[] bufferGroups = new BufferGroup[POOL_SIZE];
static {
for (int i = 0; i < POOL_SIZE; i++) {
bufferGroups[i] = new BufferGroup("buffer_group-" + i);
}
}
public void save(ISerializable data) {
bufferGroups[ThreadLocalRandom.current().nextInt(0, POOL_SIZE)].save(data);
}
}
}
......
......@@ -19,9 +19,9 @@ public class AtomicRangeInteger extends Number implements java.io.Serializable {
/**
* Creates a new AtomicInteger with the given initial value and max value
*
* @param initialValue
* @param startValue
* the initial value
* @param endValue
* @param maxValue
*
* AtomicRangeInteger在startValue和maxValue循环取值( startValue <= value < maxValue)
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册