Thread: [Htmlparser-user] Hang out when fetching page - JDK 1.5
Brought to you by:
derrickoswald
From: Java P. <jpr...@gm...> - 2006-04-05 15:06:14
|
Hello, I have problem with hanging out fetching threads - in few cases the running threads stops when entering such method: public void fetch() throws ParserException{ Parser parser =3D new Parser(this.url); visitor =3D new SimplePageVisitor(); parser.visitAllNodesWith(visitor); } I logged what cause hang out and code stops right on: Parser parser =3D new Parser(this.url); I saw several times that "java.net.SocketTimeoutException: Read timed out" was thrown, but not in that case (thread just hangs for hours until I don't kill it by hand). I searched for solution but without luck. If anyone can help I apperciate it. Best regards, Adr |
From: Riaan S. <ud...@un...> - 2006-05-04 12:37:22
|
Hi I was reading though the email archives, and saw the posts with this subject, I'm facing the same problem, and also for me setting those properties : System.setProperty ("sun.net.client.defaultReadTimeout", "7000"); System.setProperty ("sun.net.client.defaultConnectTimeout", "7000"); does not have any effect. Has anyone found any solution to this problem, or faced anything similar ? Regards Riaan |
From: Derrick O. <Der...@Ro...> - 2006-04-06 04:16:53
|
You might want to set the connect timeout in your mainline: System.setProperty ("sun.net.client.defaultReadTimeout", "7000"); System.setProperty ("sun.net.client.defaultConnectTimeout", "7000"); Java Programmer wrote: >Hello, >I have problem with hanging out fetching threads - in few cases the >running threads stops when entering such method: > >public void fetch() throws ParserException{ > Parser parser = new Parser(this.url); > visitor = new SimplePageVisitor(); > parser.visitAllNodesWith(visitor); >} > >I logged what cause hang out and code stops right on: Parser parser = >new Parser(this.url); > >I saw several times that "java.net.SocketTimeoutException: Read timed >out" was thrown, but not in that case (thread just hangs for hours >until I don't kill it by hand). > >I searched for solution but without luck. > >If anyone can help I apperciate it. > >Best regards, >Adr > > >------------------------------------------------------- >This SF.Net email is sponsored by xPML, a groundbreaking scripting language >that extends applications into web and mobile media. Attend the live webcast >and join the prime developer group breaking into this new coding territory! >http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642 >_______________________________________________ >Htmlparser-user mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/htmlparser-user > > > |
From: Java P. <jpr...@gm...> - 2006-04-07 09:43:39
|
On 4/6/06, Derrick Oswald <Der...@ro...> wrote: > > You might want to set the connect timeout in your mainline: > System.setProperty ("sun.net.client.defaultReadTimeout", "7000"); > System.setProperty ("sun.net.client.defaultConnectTimeout", "7000= "); > Hello, I don't know the reason but it completly doesn't work for me - I checked http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html so this property is checked for 1.5, but partial code below still freezes for some URLs which don't respond. System.setProperty ("sun.net.client.defaultReadTimeout", "1500"); System.setProperty ("sun.net.client.defaultConnectTimeout", "1500"); String page =3D"", line =3D ""; try { =09URL url =3D new URL("http://www.i-am-bad-url-and-dont-respond.com/"); =09/*URLConnection urlconn =3D url.openConnection(); =09InputStream in =3D urlconn.getInputStream();*/ =09InputStream in =3D url.openStream(); =09Reader r =3D new InputStreamReader(in); =09BufferedReader br =3D new BufferedReader(r); =09while((line=3Dbr.readLine())!=3Dnull){ =09=09page +=3D line; =09} } catch (MalformedURLException e) { =09System.out.println(e.getMessage()); } catch (IOException e) { =09System.out.println(e.getMessage()); } //it will never gets here It's piece of code to test properties but I have exactly same situation with HTMLParser, and don't know where is the problem. Sorry, to ask again same question but it's really frustrating for me not to have simple timeout for connection :( If anyone have other hint/clue for this pls answer me. Best regards, Adr |