public List<AgentStat> mapRow(Result result, int rowNum) throws Exception { if (result.isEmpty()) { return Collections.emptyList(); } Map<byte[], byte[]> qualifierMap = result.getFamilyMap(AGENT_STAT_CF_STATISTICS); // FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase. if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_V1)) { return readAgentStatThriftDto(qualifierMap.get(AGENT_STAT_CF_STATISTICS_V1)); } AgentStat agentStat = new AgentStat(); if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_MEMORY_GC)) { AgentStatMemoryGcBo.Builder builder = new AgentStatMemoryGcBo.Builder(qualifierMap.get(AGENT_STAT_CF_STATISTICS_MEMORY_GC)); agentStat.setMemoryGc(builder.build()); } if (qualifierMap.containsKey(AGENT_STAT_CF_STATISTICS_CPU_LOAD)) { AgentStatCpuLoadBo.Builder builder = new AgentStatCpuLoadBo.Builder(qualifierMap.get(AGENT_STAT_CF_STATISTICS_CPU_LOAD)); agentStat.setCpuLoad(builder.build()); } List<AgentStat> agentStats = new ArrayList<AgentStat>(); agentStats.add(agentStat); return agentStats; }
// FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase. private List<AgentStat> readAgentStatThriftDto(byte[] tAgentStatByteArray) throws TException { // CompactProtocol used TDeserializer deserializer = new TDeserializer(factory); TAgentStat tAgentStat = new TAgentStat(); deserializer.deserialize(tAgentStat, tAgentStatByteArray); TJvmGc gc = tAgentStat.getGc(); if (gc == null) { return Collections.emptyList(); } AgentStatMemoryGcBo.Builder memoryGcBoBuilder = new AgentStatMemoryGcBo.Builder( tAgentStat.getAgentId(), tAgentStat.getStartTimestamp(), tAgentStat.getTimestamp()); memoryGcBoBuilder.gcType(gc.getType().name()); memoryGcBoBuilder.jvmMemoryHeapUsed(gc.getJvmMemoryHeapUsed()); memoryGcBoBuilder.jvmMemoryHeapMax(gc.getJvmMemoryHeapMax()); memoryGcBoBuilder.jvmMemoryNonHeapUsed(gc.getJvmMemoryNonHeapUsed()); memoryGcBoBuilder.jvmMemoryNonHeapMax(gc.getJvmMemoryNonHeapMax()); memoryGcBoBuilder.jvmGcOldCount(gc.getJvmGcOldCount()); memoryGcBoBuilder.jvmGcOldTime(gc.getJvmGcOldTime()); AgentStat agentStat = new AgentStat(); agentStat.setMemoryGc(memoryGcBoBuilder.build()); List<AgentStat> result = new ArrayList<AgentStat>(1); result.add(agentStat); return result; }