java - SAXReader() timeout -
im having saxreader() parse , read rss-feed. want ensure wont try read long period. want ensure if reader hasnt received response or within x seconds, abort.
my code:
saxreader reader = new saxreader(); document doc = reader.read(new url(myurl));
this inside try/catch.
you can tweak urlconnection
opening manually:
url myurl = geturltoload(); urlconnection con = myurl.openconnection() con.setconnecttimeout(1000); con.setreadtimeout(2000); inputstream in = con.getinputstream(); // parse in want
Comments
Post a Comment