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.
This commit is contained in:
parent
e8893fd712
commit
6248e79021
|
@ -154,7 +154,7 @@ public class FbScraper {
|
||||||
void scrapeEvent(String event_url) {
|
void scrapeEvent(String event_url) {
|
||||||
FbEventScraper scraper = new FbEventScraper(this, event_url);
|
FbEventScraper scraper = new FbEventScraper(this, event_url);
|
||||||
tasks.add(scraper);
|
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);
|
FbPageScraper scraper = new FbPageScraper(this, page_url);
|
||||||
|
|
||||||
tasks.add(scraper);
|
tasks.add(scraper);
|
||||||
scraper.execute();
|
scraper.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,7 +215,7 @@ public class FbScraper {
|
||||||
|
|
||||||
Log.d("scraperLog", "redirectUrl: "+url);
|
Log.d("scraperLog", "redirectUrl: "+url);
|
||||||
|
|
||||||
resolver.execute();
|
resolver.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
protected void redirectionResultCallback(String url) {
|
protected void redirectionResultCallback(String url) {
|
||||||
this.input_url = url;
|
this.input_url = url;
|
||||||
|
|
Loading…
Reference in New Issue