From: David ‘Bombe’ Roden Date: Sun, 15 Mar 2009 23:41:31 +0000 (+0100) Subject: Add collected pages after URL fetcher is done. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=3b581fc7c2aba46258a746c83ca89ac3a13b55d1;p=arachne.git Add collected pages after URL fetcher is done. --- diff --git a/src/net/pterodactylus/arachne/core/Core.java b/src/net/pterodactylus/arachne/core/Core.java index a2c50cd..8afe014 100644 --- a/src/net/pterodactylus/arachne/core/Core.java +++ b/src/net/pterodactylus/arachne/core/Core.java @@ -139,11 +139,19 @@ public class Core extends AbstractService { logger.log(Level.INFO, "Skipping “" + nextPage + "”."); continue; } - URLFetcher urlFetcher; + final URLFetcher urlFetcher; try { logger.log(Level.INFO, "Fetching “" + nextURL + "”..."); urlFetcher = new URLFetcher(parserFactory, nextURL); - urlFetcherExecutor.execute(urlFetcher); + urlFetcherExecutor.execute(new Runnable() { + + public void run() { + urlFetcher.run(); + for (Page page : urlFetcher.getCollectedPages()) { + addPage(page); + } + } + }); } catch (NoSuchAlgorithmException nsae1) { logger.log(Level.SEVERE, "Could not get “SHA-256” message digest!", nsae1); }