@Override
    public LinkHistogramSummary selectLinkHistogramData(Application fromApplication, Application toApplication, TimeWindow timeWindow) {
        Objects.requireNonNull(fromApplication, "fromApplication");
        Objects.requireNonNull(toApplication, "toApplication");
        Objects.requireNonNull(timeWindow, "range");

        LinkDataDuplexMap linkDataDuplexMap;
        ServiceType fromApplicationServiceType = fromApplication.getServiceType();
        LinkDirection linkDirection = LinkDirection.OUT_LINK;
        if (fromApplicationServiceType.isUser()) {
            //scan using toApplication to distinguish same applicationName with different serviceType
            linkDirection = LinkDirection.IN_LINK;
            LinkDataMapProcessor sourceApplicationFilter = new SourceApplicationFilter(fromApplication);
            LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, sourceApplicationFilter);
            linkDataDuplexMap = linkSelector.select(Collections.singletonList(toApplication), timeWindow, 0, 1);
        } else {
            LinkDataMapProcessor destinationApplication = new DestinationApplicationFilter(toApplication);
            LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplication, LinkDataMapProcessor.NO_OP);
            linkDataDuplexMap = linkSelector.select(Collections.singletonList(fromApplication), timeWindow, 1, 0);
        }

        NodeList nodeList = NodeListFactory.createNodeList(linkDataDuplexMap);
        Range range = timeWindow.getWindowRange();
        LinkList linkList = LinkListFactory.createLinkList(nodeList, linkDataDuplexMap, range);
        LinkKey linkKey = new LinkKey(fromApplication, toApplication);
        Link link = linkList.getLink(linkKey);
        if (link == null) {
            return createEmptyLinkHistogramSummary(linkDirection, fromApplication, toApplication, range);
        }
        return new LinkHistogramSummary(link);
    }
@author HyunGil Jeong
@author jaehong.kim
web/src/main/java/com/navercorp/pinpoint/web/applicationmap/service/ResponseTimeHistogramServiceImpl.java