private synchronized void loadQueue(int numberOfLinks) {
        logger.info("Loading more links from frontier into the scheduler...");
        frontier.commit();

        Context timerContext = frontierLoadTimer.time();
        try (TupleIterator<LinkRelevance> it = frontier.iterator()) {

            int rejectedLinks = 0;
            int uncrawledLinks = 0;
            int linksAvailable = 0;

            this.startSelection(numberOfLinks);

            while (it.hasNext()) {
                try {
                    LinkRelevance link = it.next().getValue();

                    if (frontier.isDisallowedByRobots(link)) {
                        continue;
                    }

                    // Links already downloaded or not relevant
                    if (link.getRelevance() <= 0) {
                        if (recrawlSelector != null) {
                            recrawlSelector.evaluateLink(link);
                        }
                        continue;
                    }

                    uncrawledLinks++;

                    // check whether link can be download now according to politeness constraints
                    if (scheduler.canInsertNow(link)) {
                        // consider link to be downloaded
                        linkSelector.evaluateLink(link);
                        linksAvailable++;
                    } else {
                        rejectedLinks++;
                    }
                } catch (Exception e) {
                    // just log the exception and continue the load even when some link fails
                    logger.error("Failed to load link in frontier.", e);
                }
            }

            this.addSelectedLinksToScheduler(recrawlSelector);
            rejectedLinks += this.addSelectedLinksToScheduler(linkSelector);

            this.uncrawledLinksDuringLoad = uncrawledLinks;
            this.rejectedLinksDuringLoad = rejectedLinks;
            this.availableLinksDuringLoad = linksAvailable;
            
            this.hasUncrawledLinks = rejectedLinks != 0 || uncrawledLinks != 0;

        } catch (Exception e) {
            logger.error("Failed to read items from the frontier.", e);
        } finally {
            timerContext.stop();
        }
    }
This method loads links from the frontier (stored in disk) to the scheduler. The is scheduler
is a in-memory data structure that prioritizes links base on score and also politeness
constraints. Which links are selected to be inserted in the frontier is determined the policy
implemented by the LinkSelector configured.

@param numberOfLinks
ache/src/main/java/achecrawler/link/frontier/CrawlScheduler.java