Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Timeout while fetching" URLFetch GAE/J

I'm using the XMLReader to simply read a feed like below.

URLConnection urlConnection = url.openConnection(); 
XmlReader reader = new XmlReader(urlConnection); 

When this is called I receive within 5 seconds an IOException "Timeout while fetching". So I tried to set the timeouts to the max. (10 sec) but still no luck and still an IOExeption in 5 sec.

urlConnection.setConnectTimeout(10000); 

(the max is stated in documentation: http://code.google.com/intl/nl-NL/appengine/docs/java/urlfetch/overview.html)

Seems that the size of the feed is too large. When I call a smaller feed it works properly. Is there any workaround or solution for this? I need to be able to call larger feeds.

like image 891
Ben Groot Avatar asked Nov 08 '10 14:11

Ben Groot


1 Answers

You should use setReadTimeout method that sets the read deadline:

urlConnection.setReadTimeout(10000); //10 Sec

You should be able to download larger feeds in 10 seconds.
If you still have problem, try to fiddle with this different approach.

like image 52
systempuntoout Avatar answered Oct 07 '22 17:10

systempuntoout