Index: trunk/lucene-search-2/src/org/wikimedia/lsearch/oai/OAIHarvester.java |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | import java.net.Authenticator; |
8 | 8 | import java.net.MalformedURLException; |
9 | 9 | import java.net.URL; |
| 10 | +import java.net.URLConnection; |
10 | 11 | import java.util.ArrayList; |
11 | 12 | |
12 | 13 | import org.apache.log4j.Logger; |
— | — | @@ -65,7 +66,11 @@ |
66 | 67 | for(int tryNum = 1; tryNum <= this.retries; tryNum++){ |
67 | 68 | try{ |
68 | 69 | collector = new IndexUpdatesCollector(iid); |
69 | | - InputStream in = new BufferedInputStream(url.openStream()); |
| 70 | + URLConnection urlConn = url.openConnection(); |
| 71 | + // set some timeouts |
| 72 | + urlConn.setReadTimeout(60 * 1000); // 60 seconds |
| 73 | + urlConn.setConnectTimeout(60 * 1000); // 60 seconds |
| 74 | + InputStream in = new BufferedInputStream(urlConn.getInputStream()); |
70 | 75 | parser = new OAIParser(in,collector); |
71 | 76 | parser.parse(); |
72 | 77 | resumptionToken = parser.getResumptionToken(); |