Add timeout for Http request

This commit is contained in:
xinxin 2015-08-08 19:04:16 -07:00
parent a777c89ef6
commit e3140573ac

View File

@ -83,6 +83,8 @@ public class HttpDownloader extends Downloader {
} else { } else {
connection = (HttpURLConnection) sourceUrl.openConnection(); connection = (HttpURLConnection) sourceUrl.openConnection();
} }
connection.setConnectTimeout(10000);
connection.setReadTimeout(40000);
} }
protected void doDownload() throws IOException, InterruptedException { protected void doDownload() throws IOException, InterruptedException {