Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By wsaryada

Thread: Using java threads

  1. #1
    rooster21 is offline Member
    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

    Default 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.

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    757
    Rep Power
    8

    Default Re: Using java threads

    What about setting the connection timeout in the URLConnection object? Didn't it help?
    Fubarable likes this.

  3. #3
    rooster21 is offline Member
    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

    Default Re: Using java threads

    Thanks for hint.. connection timeout didn't help but i tried read timeout, it did. Thank you again.. :)

Similar Threads

  1. Threads per Connection or Threads per Request
    By Felic in forum New To Java
    Replies: 4
    Last Post: 11-22-2011, 09:15 PM
  2. Java threads
    By naik_amit in forum Threads and Synchronization
    Replies: 1
    Last Post: 08-25-2010, 11:21 PM
  3. Threads in Java
    By ZeCute in forum New To Java
    Replies: 2
    Last Post: 05-20-2010, 04:06 PM
  4. How to use Java threads
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 06:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •