From d5a7ca6a930eadc02c4dde2071ee091ffa16ae15 Mon Sep 17 00:00:00 2001 From: Woonduk Kang Date: Thu, 10 Oct 2013 07:30:22 +0000 Subject: [PATCH] =?UTF-8?q?[=EA=B0=95=EC=9A=B4=EB=8D=95]=20[LUCYSUS-1744]?= =?UTF-8?q?=20executorName=EC=9D=84=20=EC=A2=80=EB=8D=94=20=EC=A0=95?= =?UTF-8?q?=ED=99=95=ED=9E=88=20=EA=B0=80=EC=A7=80=EA=B3=A0=20=EC=9E=88?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95.?= 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@2486 84d0f5b1-2673-498c-a247-62c4ff18d310 --- .../sender/AsyncQueueingExecutor.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/nhn/pinpoint/profiler/sender/AsyncQueueingExecutor.java b/src/main/java/com/nhn/pinpoint/profiler/sender/AsyncQueueingExecutor.java index b70bd3177..529520f84 100644 --- a/src/main/java/com/nhn/pinpoint/profiler/sender/AsyncQueueingExecutor.java +++ b/src/main/java/com/nhn/pinpoint/profiler/sender/AsyncQueueingExecutor.java @@ -18,9 +18,9 @@ public class AsyncQueueingExecutor implements Runnable { private static final AsyncQueueingExecutorListener EMPTY_LISTENER = new EmptyAsyncQueueingExecutorListener(); private final Logger logger = LoggerFactory.getLogger(this.getClass()); + private final boolean isWarn = logger.isWarnEnabled(); private final LinkedBlockingQueue queue; - private final ThreadFactory threadFactory; private final AtomicBoolean isRun = new AtomicBoolean(true); private final Thread executeThread; private final String executorName; @@ -40,13 +40,13 @@ public class AsyncQueueingExecutor implements Runnable { if (executorName == null) { throw new NullPointerException("executorName must not be null"); } - this.executorName = executorName; this.queue = new LinkedBlockingQueue(queueSize); - this.threadFactory = new PinpointThreadFactory(executorName, true); - this.executeThread = this.createExecuteThread(); + this.executeThread = this.createExecuteThread(executorName); + this.executorName = executeThread.getName(); } - private Thread createExecuteThread() { + private Thread createExecuteThread(String executorName) { + final ThreadFactory threadFactory = new PinpointThreadFactory(executorName, true); Thread thread = threadFactory.newThread(this); thread.start(); return thread; @@ -54,8 +54,7 @@ public class AsyncQueueingExecutor implements Runnable { @Override public void run() { - Thread thread = Thread.currentThread(); - logger.info("{}-({}) started.", thread.getName(), thread.getId()); + logger.info("{} started.", executorName); doExecute(); } @@ -116,23 +115,23 @@ public class AsyncQueueingExecutor implements Runnable { } public boolean execute(Object data) { - final boolean warnEnabled = logger.isWarnEnabled(); + if (data == null) { - if (warnEnabled) { + if (isWarn) { logger.warn("execute(). data is null"); } return false; } if (!isRun.get()) { - if (warnEnabled) { - logger.warn("{} is shutdown. discard data:{}", this.executorName, data); + if (isWarn) { + logger.warn("{} is shutdown. discard data:{}", executorName, data); } return false; } boolean offer = queue.offer(data); if (!offer) { - if (warnEnabled) { - logger.warn("{} Drop data. queue is full. size:{}", this.executorName, queue.size()); + if (isWarn) { + logger.warn("{} Drop data. queue is full. size:{}", executorName, queue.size()); } } return offer;