From 6248e79021fdb9ae4603d7fa142710afef023549 Mon Sep 17 00:00:00 2001 From: akaessens <24660231+akaessens@users.noreply.github.com> Date: Tue, 10 Aug 2021 12:36:40 +0200 Subject: [PATCH] Replace asyncTasks execute with actual parallel async execution Using executeOnExecutor(asyncTask.THREAD_POOL_EXECUTOR) all pages are scraped in parallel. Related: #33 Note: with Android 11 the whole Aync Task is deprecated, therefore needs to be replaced in the future. --- app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java b/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java index 2794160..0fc3795 100644 --- a/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java +++ b/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java @@ -154,7 +154,7 @@ public class FbScraper { void scrapeEvent(String event_url) { FbEventScraper scraper = new FbEventScraper(this, event_url); tasks.add(scraper); - scraper.execute(); + scraper.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -183,7 +183,7 @@ public class FbScraper { FbPageScraper scraper = new FbPageScraper(this, page_url); tasks.add(scraper); - scraper.execute(); + scraper.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } /** @@ -215,7 +215,7 @@ public class FbScraper { Log.d("scraperLog", "redirectUrl: "+url); - resolver.execute(); + resolver.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } protected void redirectionResultCallback(String url) { this.input_url = url;