You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can override the method "onBeforeExit()" to collect urls the program crawled.But the WebCrawler instance will destoryed when the current thread was dead and the variable for saving url list defined in subclass of WebCrawler would be reset so I cannot collect the urls that the program crawled.
Could u give me some demos to resolve my puzzle?
BTW,I am a java leaner,thx 4 providing such a great open-source project!
The text was updated successfully, but these errors were encountered:
public class MyCrawler extends WebCrawler {
public static AtomicInteger linkCounter = new AtomicInteger(); //or use links.size()
static List links = new CopyOnWriteArrayList();
...
} @OverRide
public void handlePageStatusCode(final WebURL webUrl, int statusCode, String statusDescription) {
linkCounter.incrementAndGet();
links.add(webUrl);
}
so you can count the amount of urls and collect them to collection.
public class MyCrawler extends WebCrawler {
public static AtomicInteger linkCounter = new AtomicInteger(); //or use
links.size()
static List links = new CopyOnWriteArrayList();
...
} @OverRidehttps://github.com/Override
public void handlePageStatusCode(final WebURL webUrl, int statusCode,
String statusDescription) {
linkCounter.incrementAndGet();
links.add(webUrl);
}
so you can count the amount of urls and collect them to collection.
—
Reply to this email directly or view it on GitHub #111 (comment).
I can override the method "onBeforeExit()" to collect urls the program crawled.But the WebCrawler instance will destoryed when the current thread was dead and the variable for saving url list defined in subclass of WebCrawler would be reset so I cannot collect the urls that the program crawled.
Could u give me some demos to resolve my puzzle?
BTW,I am a java leaner,thx 4 providing such a great open-source project!
The text was updated successfully, but these errors were encountered: