Results 1 to 3 of 3
Thread: Using java threads
- 06-03-2012, 05:31 AM #1
Member
- Join Date
- Jun 2012
- Posts
- 2
- Rep Power
- 0
Using java threads
I have a java code to read the page from url. The program waits indefinitely for a long time when it reaches the below code.
BufferedReader br = new BufferedReader (new InputstreamReader (url.getInputStream());
Is there a threading functionality or timer method that i can wrap around this line? while it reaches certain threshold time, it should skip this line and print "error reading url"
Any help on this would be greatly appreciable.
- 06-03-2012, 03:17 PM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 696
- Rep Power
- 6
Re: Using java threads
What about setting the connection timeout in the URLConnection object? Didn't it help?
Website: Learn Java by Examples
- 06-04-2012, 05:05 AM #3
Member
- Join Date
- Jun 2012
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Threads per Connection or Threads per Request
By Felic in forum New To JavaReplies: 4Last Post: 11-22-2011, 09:15 PM -
Java threads
By naik_amit in forum Threads and SynchronizationReplies: 1Last Post: 08-25-2010, 11:21 PM -
Threads in Java
By ZeCute in forum New To JavaReplies: 2Last Post: 05-20-2010, 04:06 PM -
How to use Java threads
By Java Tip in forum java.langReplies: 0Last Post: 04-09-2008, 06:30 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks