简体   繁体   中英

How to change Java ROME parser default socket timeout?

I am parsing a fair amount of RSS feeds in cascade using Java ROME as my XML parser. Sometimes one of the RSS feeds might be unreachable because of network issues, which results in a Socket timeout when trying to create the XMLReader object ( new XMLReader(url)).

The problem is that the default timeout lasts about 2 decades and when it happens it's slowing down the whole process.

Is there a way to change the default socket timeout in Java ROME?

When you create XMLReader object ( new XMLReader(url)) , you already have a URLConnection object which is passed as the argument for XMLReader . Call, setConnectTimeout(long) of URLConnection and set your timeout value. I dont think Rome provides any connection timeout options

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM