private List<LinkData> replaceLinkData(LinkDirection direction, LinkData linkData, TimeWindow timeWindow) {
        final Application toApplication = linkData.getToApplication();
        if (toApplication.getServiceType().isRpcClient() || toApplication.getServiceType().isQueue()) {
            // rpc client's destination could have an agent installed in which case the link data must be replaced to point
            // to the destination application.
            logger.debug("Finding {} accept applications for {}, {}", direction, toApplication, timeWindow.getWindowRange());
            final Set<AcceptApplication> acceptApplicationList = findAcceptApplications(linkData.getFromApplication(), toApplication.getName(), timeWindow.getWindowRange());
            logger.debug("Found {} accept applications: {}", direction, acceptApplicationList);
            if (CollectionUtils.hasLength(acceptApplicationList)) {
                if (acceptApplicationList.size() == 1) {
                    logger.debug("Application info replaced. {} {} => {}", direction, linkData, acceptApplicationList);

                    AcceptApplication first = acceptApplicationList.iterator().next();
                    final LinkData acceptedLinkData = LinkData.copyOf(linkData.getFromApplication(), first.getApplication(), linkData.getLinkCallDataMap());
                    return Collections.singletonList(acceptedLinkData);
                } else {
                    // special case - there are more than 2 nodes grouped by a single url
                    return virtualLinkMarker.createVirtualLink(linkData, toApplication, acceptApplicationList);
                }
            } else {
                // for queues, accept application may not exist if no consumers have an agent installed
                if (toApplication.getServiceType().isQueue()) {
                    return Collections.singletonList(linkData);
                } else {
                    final Application unknown = new Application(toApplication.getName(), ServiceType.UNKNOWN);
                    final LinkData unknownLinkData = LinkData.copyOf(linkData.getFromApplication(), unknown, linkData.getLinkCallDataMap());
                    return Collections.singletonList(unknownLinkData);
                }
            }
        }
        return Collections.singletonList(linkData);
    }
Replaces link data pointing to domains into applications if the target has an agent installed.

@author HyunGil Jeong
web/src/main/java/com/navercorp/pinpoint/web/applicationmap/map/processor/RpcCallProcessor.java