[강운덕] [LUCYSUS-1744] 자료구조의 key를 문자열로 쓰는 부분 수정을 위해 리팩토링

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@2885 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2013-11-13 01:57:08 +00:00
parent 43c7b57d8c
commit c8eb9dce18
5 changed files with 35 additions and 20 deletions
@@ -17,18 +17,18 @@ import com.nhn.pinpoint.web.util.Mergeable;
*/
public class TransactionFlowStatistics implements Mergeable<String, TransactionFlowStatistics> {
protected String id;
protected String from;
protected ServiceType fromServiceType;
protected String to;
protected ServiceType toServiceType;
private String id;
private String from;
private ServiceType fromServiceType;
private String to;
private ServiceType toServiceType;
/**
* key = hostname
*/
protected Map<String, Host> toHostList;
protected Set<AgentInfoBo> toAgentSet;
private Map<String, Host> toHostList;
private Set<AgentInfoBo> toAgentSet;
public TransactionFlowStatistics(String from, short fromServiceType, String to, short toServiceType) {
this.from = from;
@@ -23,7 +23,6 @@ import com.nhn.pinpoint.common.bo.SpanBo;
import com.nhn.pinpoint.common.bo.SpanEventBo;
import com.nhn.pinpoint.web.applicationmap.ApplicationMap;
import com.nhn.pinpoint.web.applicationmap.rawdata.TransactionFlowStatistics;
import com.nhn.pinpoint.web.applicationmap.rawdata.TransactionFlowStatisticsUtils;
import com.nhn.pinpoint.web.dao.AgentInfoDao;
import com.nhn.pinpoint.web.dao.ApplicationIndexDao;
import com.nhn.pinpoint.web.dao.ApplicationTraceIndexDao;
@@ -42,7 +41,7 @@ import com.nhn.pinpoint.web.vo.TransactionId;
@Service
public class FilteredApplicationMapServiceImpl implements FilteredApplicationMapService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private TraceDao traceDao;
@@ -290,7 +289,9 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
timeSeriesStore.add(spanEventStatId, span.getStartTime() + spanEvent.getStartElapsed(), slot2, 1L, spanEvent.hasException());
// application timeseries statistics
timeSeriesStore.add(new SimpleNodeId(spanEvent.getDestinationId()), span.getCollectorAcceptTime(), slot2, 1L, spanEvent.hasException());
// NodeId key = new ComplexNodeId(Node.EMPTY, new Node(spanEvent.getDestinationId()));
NodeId key = new SimpleNodeId(spanEvent.getDestinationId());
timeSeriesStore.add(key, span.getCollectorAcceptTime(), slot2, 1L, spanEvent.hasException());
}
}
@@ -6,9 +6,22 @@ import com.nhn.pinpoint.common.ServiceType;
* @author emeroad
*/
public class Node {
public static final Node EMPTY = new Node();
private String name;
private ServiceType serviceType;
public Node() {
}
public Node(String name) {
if (name == null) {
throw new NullPointerException("name must not be null");
}
this.name = name;
}
public Node(String name, ServiceType serviceType) {
if (name == null) {
throw new NullPointerException("name must not be null");
@@ -55,7 +68,7 @@ public class Node {
Node node = (Node) o;
if (!name.equals(node.name)) return false;
if (name != null ? !name.equals(node.name) : node.name != null) return false;
if (serviceType != node.serviceType) return false;
return true;
@@ -63,8 +76,8 @@ public class Node {
@Override
public int hashCode() {
int result = name.hashCode();
result = 31 * result + serviceType.hashCode();
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (serviceType != null ? serviceType.hashCode() : 0);
return result;
}
@@ -3,7 +3,8 @@ package com.nhn.pinpoint.web.service;
/**
* @author emeroad
*/
public class SimpleNodeId implements NodeId{
@Deprecated
public class SimpleNodeId implements NodeId {
private String key;
public SimpleNodeId(String key) {
@@ -5,10 +5,10 @@ import com.nhn.pinpoint.web.service.NodeId;
/**
*
* @author netspider
*
* @param <T>
* @param <K>
* @param <V>
*/
public interface Mergeable<I, T> {
public I getId();
public T mergeWith(T o);
public interface Mergeable<K, V> {
public K getId();
public V mergeWith(V o);
}