From 3b581fc7c2aba46258a746c83ca89ac3a13b55d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 16 Mar 2009 00:41:31 +0100 Subject: [PATCH] Add collected pages after URL fetcher is done. --- src/net/pterodactylus/arachne/core/Core.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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); } -- 2.7.4