mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-07-12 10:37:13 +00:00
Remove arbitrary 1.5 second sleep() when launching jobs
I think the sleep is supposed to make launch() not return until the job has actually been launched but it doesn't work as launch() and getCrawlController() are both synchronized therefore the launcher thread can't actually call startContext() until launch() returns after sleeping. So let's replace the sleep call with join and unsynchronize launch() so it doesn't deadlock. All the relevant methods it calls seem to be synchronized so I think it's no worse to not synchronize it itself.
This commit is contained in:
@@ -408,7 +408,7 @@ public class CrawlJob implements Comparable<CrawlJob>, ApplicationListener<Appli
|
||||
* (Note the crawl may have been configured to start in a 'paused'
|
||||
* state.)
|
||||
*/
|
||||
public synchronized void launch() {
|
||||
public void launch() {
|
||||
if (isProfile()) {
|
||||
throw new IllegalArgumentException("Can't launch profile" + this);
|
||||
}
|
||||
@@ -449,9 +449,8 @@ public class CrawlJob implements Comparable<CrawlJob>, ApplicationListener<Appli
|
||||
getJobLogger().log(Level.INFO,"Job launched");
|
||||
scanJobLog();
|
||||
launcher.start();
|
||||
// look busy (and give startContext/crawlStart a chance)
|
||||
try {
|
||||
Thread.sleep(1500);
|
||||
launcher.join();
|
||||
} catch (InterruptedException e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user