Add collected pages after URL fetcher is done.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 15 Mar 2009 23:41:31 +0000 (00:41 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 15 Mar 2009 23:41:31 +0000 (00:41 +0100)
src/net/pterodactylus/arachne/core/Core.java

index a2c50cd..8afe014 100644 (file)
@@ -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);
                        }