mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 16:56:15 +10:00
[강운덕] [PINPOINT-267] ci에 multi thread 잠재적 버그로 지적 되어 수정. 별 문제는 없으나, multi thread 잠재적 문제라 수정하였음.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@3252 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -15,18 +15,23 @@ public class TimeBaseStorage implements Storage {
|
||||
private static final boolean isDebug = logger.isDebugEnabled();
|
||||
|
||||
private static final int RESERVE_BUFFER_SIZE = 2;
|
||||
private static final int DEFAULT_BUFFER_SIZE = 20;
|
||||
|
||||
private boolean discard = true;
|
||||
|
||||
private boolean limit;
|
||||
private long limitTime = 1000;
|
||||
private int bufferSize = 20;
|
||||
private final int bufferSize;
|
||||
|
||||
private List<SpanEvent> storage = new ArrayList<SpanEvent>(bufferSize + RESERVE_BUFFER_SIZE);
|
||||
private List<SpanEvent> storage ;
|
||||
private final DataSender dataSender;
|
||||
private final SpanChunkFactory spanChunkFactory;
|
||||
|
||||
public TimeBaseStorage(DataSender dataSender, SpanChunkFactory spanChunkFactory) {
|
||||
this(dataSender, spanChunkFactory, DEFAULT_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
public TimeBaseStorage(DataSender dataSender, SpanChunkFactory spanChunkFactory, int bufferSize) {
|
||||
if (dataSender == null) {
|
||||
throw new NullPointerException("dataSender must not be null");
|
||||
}
|
||||
@@ -35,16 +40,14 @@ public class TimeBaseStorage implements Storage {
|
||||
}
|
||||
this.dataSender = dataSender;
|
||||
this.spanChunkFactory = spanChunkFactory;
|
||||
this.bufferSize = bufferSize;
|
||||
this.storage = new ArrayList<SpanEvent>(bufferSize + RESERVE_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
public void setDiscard(boolean discard) {
|
||||
this.discard = discard;
|
||||
}
|
||||
|
||||
public void setBufferSize(int bufferSize) {
|
||||
this.bufferSize = bufferSize;
|
||||
}
|
||||
|
||||
public void setLimitTime(long limitTime) {
|
||||
this.limitTime = limitTime;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,7 @@ public class TimeBaseStorageFactory implements StorageFactory {
|
||||
|
||||
@Override
|
||||
public Storage createStorage() {
|
||||
TimeBaseStorage timeBaseStorage = new TimeBaseStorage(this.dataSender, spanChunkFactory);
|
||||
timeBaseStorage.setBufferSize(this.bufferSize);
|
||||
TimeBaseStorage timeBaseStorage = new TimeBaseStorage(this.dataSender, spanChunkFactory, this.bufferSize);
|
||||
timeBaseStorage.setLimitTime(this.discardTimeLimit);
|
||||
timeBaseStorage.setDiscard(this.discardEnable);
|
||||
return timeBaseStorage;
|
||||
|
||||
Reference in New Issue
Block a user