0
我有下面的代碼:的SAXParserFactory URL超時
try{
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
/* Get the XMLReader of the SAXParser we created. */
XMLReader r = sp.getXMLReader();
//This handles the xml and populates the entries array
XMLHandler handler = new XMLHandler();
// register event handlers
r.setContentHandler(handler);
String url = "http://news.library.ryerson.ca/api/isbnsearch.php?isbn="+ISBN;
r.parse(url);
return handler.getEntries();
}
此代碼工作正常的大部分時間,但有幾種情況下,用戶可以用100多個相關的進入暢銷書的ISBN國際標準書號(例如哈利波特例如)。當發生這種情況時,XML Feed不會中斷,但加載需要更長時間(對於極端情況可能需要30秒以上)。當頁面加載時,它不會丟棄連接,只需要加載它。
有沒有辦法增加函數的超時時間?
感謝