HTTP download stops without any reason.

Hi,
I wrote the following code to download different parts of the same URL in different threads. The object manager is a custom class which manages the various threads in each download.
public void run() {
          try {
               byte [] buffer = new byte[1024];
               URLConnection conn;
               if(proxyAddr != null)
                    conn = src.openConnection(new Proxy(Proxy.Type.HTTP, proxyAddr));
               else
                    conn = src.openConnection();
               conn.setRequestProperty("Range", "bytes=" + (start + completed) + "-" + end);
               int response = ((HttpURLConnection)conn).getResponseCode();
               if(response != 200 && response != 206)
                    manager.failConnection();
               BufferedInputStream bin = new BufferedInputStream(conn.getInputStream());
               byte [] data = new byte[1024];
               int readLen;
               manager.addConnected();
               if(start == 0) {
                    System.out.println("Jing: " + end);
                    conn.setReadTimeout(5000);
                    System.out.println(conn.getReadTimeout());
               int cnt = 0;
               while((readLen = bin.read(data)) != -1
                     && canContinue) {
                    synchronized(dest) {
                         dest.seek(start+completed);
                         dest.write(data, 0, readLen);
                    synchronized(this) {
                         completed += readLen;
                         if(start == 0) {
                              System.out.println("hi" + cnt++);
                              System.out.println(completed);
               if(start == 0)
                    System.out.println("Read: " + readLen + "\t" + start + "\t" + end);
               manager.addFinished();
               bin.close();
          } catch(IOException e) {
               manager.failConnection();
               e.printStackTrace();
     }For some URLs, the thread which downloads the first part of the file begins the download and runs along with other threads but at some unpredictable point waits to read data infinitely, in spite of the fact that I've set the timeout to 5 secs. But, the other threads which download remaining parts of the file finish their downloads successfully.

I've set the timeout before opening the InputStream.
The download still stops at random places. However, by catching the SocketTimeoutException, I'm able to re-establish the connection and download the remaining content.
Thanx for ur help

Similar Messages

  • 1 minute schedule jobs stop withouyt any reason

    Hello. I have a few jobs on my sql server that runs every minute. Sometimes they stop without any reason (like they were stuck). To solve this problem I need to manully "start job at step X". I use those jobs to insert data into tables and when I
    searched on those I can see holes about 12-24 hours (hours where those jobs didn't run). Can you please help me finding out the problem?

    Did you check Job history? Does it show any error message or something that might help you?
    It may be because of locking/blocking. Objects used by your jobs are being used by some other resouces that makes job in wait state for longer. (just a guess)
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]
    I verified the job history, there eere not any erros over there. All I can see there is the last run of the job. I need to add that jobs stop working at around 23:57/23:58 PM. Those tables are only used be my so they dont block, I access them only 1-2 times
    / day with <nolock). I seached on SQL log, event viewer, traces, job history (jub runs for about 30-40 seconds, it did not run more then 1 minute)

  • Leopard asking for password without any reason ?

    Hi,
    Leopard asked me for user password without any reason. I wasn't installing any software.. just surfing the web.
    Furthermore my desktop wasn't working so I relaunched Finder.
    Is it kind of virus or is it normal ?
    thanks

    I've selected All Processes but there isn't installer... see the picture:
    http://dl.getdropbox.com/u/72686/noInstaller.png

  • Trying to be sure I have latest versions of Lightroom and Photoshop (I am on monthly subscription plan).  After I sign in - told I need "administrative privileges to continue."  The initial downloads went without any problem.

    Trying to be sure I have latest versions of Lightroom and Photoshop (I am on monthly subscription plan).  After I sign in - told I need "administrative privileges to continue."  The initial downloads went without any problem.  I am not sure what to do next.  My computer is at home.  It is a new iMac.

    Are you using your Mac with an Administrator account?
    A chat session where an agent may remotely look inside your computer may help
    Creative Cloud chat support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html

  • My macbook pro won't turn on without any reason?

    my macbook pro won't turn on without any reason, is there any solution in this case?

    You need to hit the "reply" button on post to whom your responding too, it's hard to tell if your responding to me or someone else.
    small button on the side of the computer and didn't lightting up( no reponse at all). is their any problems do think with the battery?
    Usually if your battery is dead because it wasn't charged you can do the SMC Reset and then check the Magsafe if it's connected and showing the orange light, then let the battery charge up.
    Once the battery charges up, the computer will boot normally and then you have to reset the PRAM, time, date etc.
    https://support.apple.com/kb/TS1365
    Magsafe issues: https://support.apple.com/kb/TS1713   https://support.apple.com/kb/TS4127
    *PRAM Reset  http://docs.info.apple.com/article.html?path=Mac/10.6/en/26871.html
    What's store in PRAM   https://support.apple.com/kb/HT1242
    Hardware Test
    https://support.apple.com/kb/ht1509

  • Mac mini turns off without any reason

    My Mac mini turns off without any reason. I just want to make a backup with time machine and after a while the computer doesn´t work anymore. I just see the start-screen with all the users and I had to sign with my user password. After the mac restarts, I had to start time machine again. I stopped energy-management, because I thought that might be the problem but not. Time machine should work the whole night, but I don´t want to sit the whole time next to the mac to wake him up every several minutes. What can I do?

    From the menu bar, select
     ▹ System Preferences... ▹ Security & Privacy
    If there's a closed padlock icon in the lower left corner of the preference pane, click it and enter your login password when prompted.
    Click the Advanced button and, in the sheet that opens, uncheck the box marked
    Log out after … minutes of inactivity

  • Conversion tool BO XI3 crashed with certain files without any reason

    Dear all,
    While using the conversion tool BO XI 3 to convert reports from deski to webi, I am facing some issue.
    Without any reason, any warning and any explanations afterwards, the conversion tool just close.
    And i dot not know why and how I can resolve this.
    It only happens to some of my reports.
    I opened them under BO XI 3 deski to have a look but they are working fine.
    Did anyone had this kind of problem ?
    Thank you,
    Audrey

    Yes indeed, but I have another issue (I posted another subject here) as for BO XI 3 deski:
    http://scn.sap.com/thread/3591504
    I can not open the deski files with problems because the folder is empty when trying to import from the CMS. It is like there are no documents at all whereas when I open the conversion tool they are all here (around 250).
    It is strange because as for Webi 3 I can access to CMS and import documents without any problems.

  • The i phone shut down coming off alone without any reason

    Dear Sir:
    please i need your help , as my IPHONE 4 is coming off and shut down alone, without any reason.
    and i cant put it ON again dont know why please help me.
    wishing for all good day.

    Try to resore it to latest version of iOS 7.0.4
    http://support.apple.com/kb/ht1414
    If it does not help got to APPLE.

  • Satellite L300-17L is putting itself on stand by all the time without any reason

    Hello Eldorado,
    i am sorry that this is not a question in connection to the topic, but i have L300 - 17L laptop and from time to time it is shutting down (more specifically putting it self on stand by) without any reason.
    It is not the cooler or anything else..
    The battery is full, and that is happening while i am writing or working on the laptop generally!
    The local service says that is nothing wrong with the laptop, i am so nervous, i cannot work , it is interrupting my work ..
    PLEASE HELP ME! thank you

    Hi
    So what happens exactly?
    Does the notebook shuts down or goes into standby mode?
    You said it happens from time to time this means that it would not be easy to replicated this issue and I think the technician was not able to replicate this is it right?
    What applications are running if this happens?
    Did you try to restore the notebook back to factory settings using the HDD recovery or Recovery disk? Do this!
    Check also if your BIOS is up to date!

  • HTTP SERVICE STOPS FOR NO REASON AND NO ERRORS IN LOGS WIN2K

    The HTTP service stops for no reason and we have to stop and restart to unlock and web server runs again. It appears to be related to number of concurrent users but we cannot tie it down to and specfics except on our NT 4.0 system the service never stops and runs fine . We are running versions R1 patch 4 and have gone up to 5 and 7 . We are running against an 9i database and using forms and reports. We are not using the forms server in patch 4 just the HTTP service. This is a big problem and would like an answer if possiable.

    Please post your question in the appropriate product forum(s):
    Database
    http://forums.oracle.com/forums/index.jsp?cat=18
    AppServer
    http://forums.oracle.com/forums/index.jsp?cat=13
    Forms
    Forms
    Reports
    Reports

  • Why our game removed from sale without any reasons??

    Our game golden miner is forced to be removed from sale without any reasons.
    Does other developers has similiar problem? How do you solve it?
    Thank you.

    If colorme will please forgive me, I have a quick question for you, KT...
    I'm simply trying to compute the cube of an integer, which I thought would be an easy job in Obj-C. But when I code:
    NSLog(@"20^3=%d", 20^3);
    The result in the log is 23. What's with that? Someone said something about using pow. Hello?? Is this a math program or a Batman app? Someone else asked if I could hum four bars of it. I don't think anyone is taking the time to read my question, and I'd prefer a simple answer without all the tUde!! Do you see what's going on in this case?
    - Ray

  • I Lost All My Contact without any reason

    I have lost my contact without any reason. The contact list are blank suddenly. I havent plug my iphone4 to my computer. I have shut the phone and turn it on several time but the contacts are all disappear. I havent syn the iphone with the itunes. I dun know why all my contacts are disappear. How can I recover all my contact list? THX

    I say try and go settings/mail,contacts,calendar/import sim contacts and hope they come back..
    also you could try and restore your phone from the previous back up you done,  before you plug your phone in copy your previous back-up onto your desktop so you dont lose it, then try restore your phone from that.
    thats all i could suggest
    hope it helps

  • After updating my software from snow leapord to mountain lion my  MacBook   Pro suddenly keeps shutting down without any reason no warning suddenly just restarts... Can someone help

    After updating my software from snow leapord to mountain lion my  MacBook   Pro suddenly keeps shutting down without any reason no warning suddenly just restarts... Can someone hel

    Note the date and time the problem occurred, then go to Applications/Utilities/Console and copy the log starting at the time of the crash. Paste the log in a reply. Please do not use a screen shot as they can be hard to read. If there are repeated runs of the same messages, please post only one run. Be selective about what you post and don’t  post huge amounts. Make sure there is no personal data visible. Information learned from Linc Davis.

  • My iphone 4 currently at ios 7.1.. suddenly my iPhone entered into recovery mode without any reasons.. i tried using iTunes restore the iPhone.. after the process finished... I still stuck at recovery mode. any idea?

    currently at ios 7.1.. suddenly my iPhone entered into recovery mode without any reasons.. i tried using iTunes restore the iPhone.. after the process finished... I still stuck at recovery mode. any idea?

    i have tried to restore via itunes as i would have usually, half way through i get an error code 3194 pop up.....and yes i do back up.
    Thanks for your help but i've already tried this a couple of times.

  • I can call or receive a call for 40 sec or 1 minute, then the call is interrupted without any reason. Any idea why?

    I can call or receive a call for 40 sec or 1 minute, then the call is interrupted without any reason. Any idea why?

    or reset your phone by holding down home button and power off/on until the apple logo apprears.

Maybe you are looking for

  • I preordered a abulm and it gave me two songs when they came out but now it wants me to buy it again what do i do

    Please help me get the rest of the ablum so i can listen to some new music

  • Allowing user to see a newly created table

    Hi , I have created a new table tbl1 in tblspace1 and grant select , delete , insert to user1 how can i allow the user1 to see the new table tbl1 ? kindly advise tks & rdgs

  • E71 Battery Life gone

    My E71 battery life has gone off a cliff. One day it was lasting 2-3 days with constant use. Next it's lasting less than one day. It's 6 month old. Anyone got any idea why ? I haven't changed my use, nothing is running in the background except blueto

  • Partition error

    I want to create a partition for a table on a before insert trigger of the same table. create or replace trigger eventlog_trg before insert on eventlog for each row declare pramga autonomous_transaction begin alter table eventlog add partition .....

  • Can't add iframe as HTML

    I'm putting the following code in Muse's HTML box, but it won't work. Can anyone see where I'm going wrong? <iframe name="gs3" src="http://vid1alearnerpower.businesscatalyst.com/lessons/gs3/index.html" width="1024" height="800" frameborder="0" scroll