[강운덕] [LUCYSUS-1744] SERIAL collector가 빠져 있어 수정함.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-server/trunk@2353 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2013-09-26 10:28:03 +00:00
parent 5e35fdce8a
commit a04d12cbe2
@@ -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);
}
}
}