From 879cccf43bb2d290e4157c77d0ca0c080df83f52 Mon Sep 17 00:00:00 2001 From: Woonduk Kang Date: Tue, 4 Feb 2014 09:10:48 +0000 Subject: [PATCH] =?UTF-8?q?[=EA=B0=95=EC=9A=B4=EB=8D=95]=20[PINPOINT-267]?= =?UTF-8?q?=20ci=EC=97=90=20multi=20thread=20=EC=9E=A0=EC=9E=AC=EC=A0=81?= =?UTF-8?q?=20=EB=B2=84=EA=B7=B8=EB=A1=9C=20=EC=A7=80=EC=A0=81=20=EB=90=98?= =?UTF-8?q?=EC=96=B4=20=EC=88=98=EC=A0=95.=20=EB=B3=84=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=EB=8A=94=20=EC=97=86=EC=9C=BC=EB=82=98,=20multi=20thr?= =?UTF-8?q?ead=20=EC=9E=A0=EC=9E=AC=EC=A0=81=20=EB=AC=B8=EC=A0=9C=EB=9D=BC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=ED=95=98=EC=98=80=EC=9D=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@3252 84d0f5b1-2673-498c-a247-62c4ff18d310 --- .../profiler/context/TimeBaseStorage.java | 15 +++++++++------ .../profiler/context/TimeBaseStorageFactory.java | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/nhn/pinpoint/profiler/context/TimeBaseStorage.java b/src/main/java/com/nhn/pinpoint/profiler/context/TimeBaseStorage.java index 521c29afd..46b6e52e4 100644 --- a/src/main/java/com/nhn/pinpoint/profiler/context/TimeBaseStorage.java +++ b/src/main/java/com/nhn/pinpoint/profiler/context/TimeBaseStorage.java @@ -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 storage = new ArrayList(bufferSize + RESERVE_BUFFER_SIZE); + private List 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(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; } diff --git a/src/main/java/com/nhn/pinpoint/profiler/context/TimeBaseStorageFactory.java b/src/main/java/com/nhn/pinpoint/profiler/context/TimeBaseStorageFactory.java index 6bad0f70f..87e6f52d8 100644 --- a/src/main/java/com/nhn/pinpoint/profiler/context/TimeBaseStorageFactory.java +++ b/src/main/java/com/nhn/pinpoint/profiler/context/TimeBaseStorageFactory.java @@ -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;