From a04d12cbe299fc0e96f21ea5dafbeaba3ee76b7f Mon Sep 17 00:00:00 2001 From: Woonduk Kang Date: Thu, 26 Sep 2013 10:28:03 +0000 Subject: [PATCH] =?UTF-8?q?[=EA=B0=95=EC=9A=B4=EB=8D=95]=20[LUCYSUS-1744]?= =?UTF-8?q?=20SERIAL=20collector=EA=B0=80=20=EB=B9=A0=EC=A0=B8=20=EC=9E=88?= =?UTF-8?q?=EC=96=B4=20=EC=88=98=EC=A0=95=ED=95=A8.?= 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-server/trunk@2353 84d0f5b1-2673-498c-a247-62c4ff18d310 --- .../collector/monitor/AgentStatSupport.java | 81 +++++++++---------- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/nhn/pinpoint/collector/monitor/AgentStatSupport.java b/src/main/java/com/nhn/pinpoint/collector/monitor/AgentStatSupport.java index d61e1d872..f4e553971 100644 --- a/src/main/java/com/nhn/pinpoint/collector/monitor/AgentStatSupport.java +++ b/src/main/java/com/nhn/pinpoint/collector/monitor/AgentStatSupport.java @@ -1,57 +1,48 @@ package com.nhn.pinpoint.collector.monitor; -import com.nhn.pinpoint.thrift.dto.AgentStat; -import com.nhn.pinpoint.thrift.dto.StatWithCmsCollector; -import com.nhn.pinpoint.thrift.dto.StatWithG1Collector; -import com.nhn.pinpoint.thrift.dto.StatWithParallelCollector; +import com.nhn.pinpoint.thrift.dto.*; import com.nhn.pinpoint.thrift.dto.AgentStat._Fields; /** * AgentStat 메시지에서 agentId, timestamp 등의 공통 정보를 꺼내올 수 있는 유틸리티. * AgentStat에 포함될 struct들이 agentId, timestamp 필드를 가지고 있다고 가정한다. - * + * * @author harebox */ public class AgentStatSupport { - public static String getAgentId(AgentStat agentStat) { - String result = null; - - _Fields type = agentStat.getSetField(); - Object typeObject = agentStat.getFieldValue(); - switch (type) { - case CMS: - result = ((StatWithCmsCollector) typeObject).getAgentId(); - break; - case G1: - result = ((StatWithG1Collector) typeObject).getAgentId(); - break; - case PARALLEL: - result = ((StatWithParallelCollector) typeObject).getAgentId(); - break; - } - - return result; - } - - public static long getTimestamp(AgentStat agentStat) { - long result = 0; - - _Fields type = agentStat.getSetField(); - Object typeObject = agentStat.getFieldValue(); - switch (type) { - case CMS: - result = ((StatWithCmsCollector) typeObject).getTimestamp(); - break; - case G1: - result = ((StatWithG1Collector) typeObject).getTimestamp(); - break; - case PARALLEL: - result = ((StatWithParallelCollector) typeObject).getTimestamp(); - break; - } - - return result; - } - + public static String getAgentId(AgentStat agentStat) { + _Fields type = agentStat.getSetField(); + Object typeObject = agentStat.getFieldValue(); + switch (type) { + case CMS: + return ((StatWithCmsCollector) typeObject).getAgentId(); + case G1: + return ((StatWithG1Collector) typeObject).getAgentId(); + case PARALLEL: + return ((StatWithParallelCollector) typeObject).getAgentId(); + case SERIAL: + return ((StatWithSerialCollector) typeObject).getAgentId(); + default: + throw new RuntimeException("type not found. type:" + type); + } + } + + public static long getTimestamp(AgentStat agentStat) { + _Fields type = agentStat.getSetField(); + Object typeObject = agentStat.getFieldValue(); + switch (type) { + case CMS: + return ((StatWithCmsCollector) typeObject).getTimestamp(); + case G1: + return ((StatWithG1Collector) typeObject).getTimestamp(); + case PARALLEL: + return ((StatWithParallelCollector) typeObject).getTimestamp(); + case SERIAL: + return ((StatWithSerialCollector) typeObject).getTimestamp(); + default: + throw new RuntimeException("type not found. type:" + type); + } + } + }