(crawler) Disable Java's infinite DNS caching
This commit is contained in:
parent
0fe44c9bf2
commit
75d87c73d1
@ -41,6 +41,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.security.Security;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
@ -100,11 +101,15 @@ public class CrawlerMain {
|
||||
}
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
|
||||
if (!AbortMonitor.getInstance().isAlive()) {
|
||||
System.err.println("Remove abort file first");
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent Java from caching DNS lookups forever (filling up the system RAM as a result)
|
||||
Security.setProperty("networkaddress.cache.ttl" , "3600");
|
||||
|
||||
// This must run *early*
|
||||
System.setProperty("http.agent", WmsaHome.getUserAgent().uaString());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user