HttpURLConnection when fetching stalls for no reason

On rare occasions my fetcher class stalls for no reason? the only solution i can think of is to put it in a seperate Thread and check the time it started to download and the compare it with the current time - if over 5 minutes difference close the Thread down,
any other solutions or suggestions?
little bit of code here that handles the actual fetching of the webpage
                               g.log("fetching>"+u);
          String html = "";
          URL url;
          HttpURLConnection conn; // connection to the web page
          BufferedReader rd; // Used to read the web page
          String line; // individual line of the html
          try {
                url = new URL(u.toLowerCase());
                conn = (HttpURLConnection)url.openConnection();
                conn.setRequestProperty("User-Agent", "Mozilla/5.0 (my-user-agent-name-here) Honour: robots.txt, Delayed");
                //conn.setRequestProperty("User-Agent", "Mozilla/5.0");
                conn.setRequestMethod("GET");
                rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
               while ((line = rd.readLine()) != null) {
                    html+="\n"+line;
               rd.close();
               html = html.trim();
          } catch (Exception e) {
               //e.printStackTrace();
               g.log("Exception>"+e+"\nproblem fetching>"+u);
               return "";
          g.log("fetched>"+u+"["+html.length()+"bytes]");
          return html;

you could be suffering from _*wireless interference*_.
perhaps one of your neighbor's wireless networks is interfering with yours. download iStumbler (free) or AirRadar (it has a trial period) and note the channels other networks in your area are broadcasting on. *change the channel(s) of your network as far away as possible from those*.

Similar Messages

Maybe you are looking for

  • Duplicate condition records with BAPI_SALESORDER_CREATEFROMDAT2

    you don't have to pass the bapisdls at all. Just don't pass the bapisdls. make sure that you're passing kschl, kbetr kmein kwert in the conditions_in parameter to the bapi. That should do it.

  • How to generate multiple records on a single sql from dual table

    I wanted to generate ten sequence nos in a single sql statement from dual table. Is there any way to use that. I think somebody can help me on this by using level clause

  • How to stop validation for Back action in ADF

    Hi, In ADF form, I have a 'Back' button which should just go back to the previous page. But when I select 'Back' button, the form is validated again and I do get validation error messages. How can I stop validation for these type of simple actions? P

  • LMS 4.2 discovery failure

    Hi I have Cisco LMS 4.2 installed i was using SNMP V2c for polling my devices. After i turned on SNMPv3 all devices are reachable and even when i make credentials check it's ok, but the issue when i access any device from search pane it shows me in t

  • Getting total pages incorect in SAPSCRIPT FORM with SAPSCRIPT-FORMPAGES

    Hi, In scriptform I have total 3 pages, one is envelope_page, second is page_first, and third page_next. I want total no pages excluding envelop page, I have given HOLD for envelop page, START for first page, and INC for next page. Now when I run, I