public void insertOutlinks(Page page) throws LinkClassifierException {

        LinkRelevance[] linksRelevance = outlinkClassifier.classify(page);

        ArrayList<LinkRelevance> temp = new ArrayList<>();
        HashSet<String> relevantURLs = new HashSet<>();

        for (LinkRelevance linkRelevance : linksRelevance) {
            if (this.isRelevant(linkRelevance)) {

                String url = linkRelevance.getURL().toString();
                if (!relevantURLs.contains(url)) {

                    String domain = linkRelevance.getTopLevelDomainName();

                    Integer domainCount;
                    synchronized (domainCounter) {
                        domainCount = domainCounter.get(domain);
                        if (domainCount == null) {
                            domainCount = 0;
                        } else {
                            domainCount++;
                        }
                        domainCounter.put(domain, domainCount);
                    }

                    if (domainCount < maxPagesPerDomain) { // Stop Condition
                        relevantURLs.add(url);
                        temp.add(linkRelevance);
                    }

                }
            }
        }

        LinkRelevance[] filteredLinksRelevance =
                temp.toArray(new LinkRelevance[relevantURLs.size()]);

        LinkNeighborhood[] lns = page.getParsedData().getLinkNeighborhood();
        for (int i = 0; i < lns.length; i++) {
            if (!relevantURLs.contains(lns[i].getLink().toString())) {
                lns[i] = null;
            }
        }

        graphRepository.insertOutlinks(page.getURL(), lns);
        this.insert(filteredLinksRelevance);
    }
This class manages the crawler frontier

@author Luciano Barbosa
@version 1.0
ache/src/main/java/achecrawler/link/frontier/FrontierManager.java