http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88353

Revision: 88353
Author:   rainman
Date:     2011-05-17 21:35:18 +0000 (Tue, 17 May 2011)
Log Message:
-----------
Add connection timeouts since there seems to be a broken WMF server that never 
end the connection

Modified Paths:
--------------
    trunk/lucene-search-2/src/org/wikimedia/lsearch/oai/OAIHarvester.java

Modified: trunk/lucene-search-2/src/org/wikimedia/lsearch/oai/OAIHarvester.java
===================================================================
--- trunk/lucene-search-2/src/org/wikimedia/lsearch/oai/OAIHarvester.java       
2011-05-17 21:21:21 UTC (rev 88352)
+++ trunk/lucene-search-2/src/org/wikimedia/lsearch/oai/OAIHarvester.java       
2011-05-17 21:35:18 UTC (rev 88353)
@@ -6,6 +6,7 @@
 import java.net.Authenticator;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.ArrayList;
 
 import org.apache.log4j.Logger;
@@ -65,7 +66,11 @@
                for(int tryNum = 1; tryNum <= this.retries; tryNum++){
                        try{
                                collector = new IndexUpdatesCollector(iid);
-                               InputStream in = new 
BufferedInputStream(url.openStream());
+                               URLConnection urlConn = url.openConnection();
+                               // set some timeouts
+                               urlConn.setReadTimeout(60 * 1000); // 60 seconds
+                               urlConn.setConnectTimeout(60 * 1000); // 60 
seconds
+                               InputStream in = new 
BufferedInputStream(urlConn.getInputStream());
                                parser = new OAIParser(in,collector);
                                parser.parse();
                                resumptionToken = parser.getResumptionToken();


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to