httpclient executeMethod() leaves early

Discussion in 'Java' started by Bastian, Nov 21, 2005.

  1. Bastian

    Bastian Guest

    hello ng,

    I have a problem with the executeMethod(putmethod).

    When initiating the mehtod i see the upload on my network monitoring
    tool. but when this tool shows nomore uplaod, the method stays active
    for about 4 secs. while this time my cpu usage raises to 100% and than
    falls back to normal, when the method is left.

    Why does ist stay within the putmethod? I tried to handled it with the
    setSoTimeout() but without success.

    What can i do?

    thx
    bastian

    code:
    PutMethod method2 = null;
    try {
    method2 = new PutMethod(url+"/"+remote);
    method2.setRequestEntity(
    new InputStreamRequestEntity(
    new FileInputStream( local ) ) );
    } catch (FileNotFoundException e) {
    log.warning("File doesnt exist: " + local);
    e.printStackTrace();
    return false;
    }
    httpclient.getHttpConnectionManager().getParams().setSoTimeout(50);

    long start = 0, time = 0, bytes = local.length();
    try {
    // Execute the method.
    start = System.currentTimeMillis();
    int statusCode = httpclient.executeMethod(method2);
    time = System.currentTimeMillis() - start -
    method2.getParams().getSoTimeout();
    System.out.println("Uploading " + local.getName() + " complete. " +
    bytes/time + " KB/sec");
    System.out.println("start: " + start);
    System.out.println("time : " + time);
    System.out.println("timeo: " + method2.getParams().getSoTimeout());
     
    Bastian, Nov 21, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jorge_Beteta
    Replies:
    4
    Views:
    8,759
    Shiv Kumar
    Jan 12, 2004
  2. SpamProof

    ghostscript leaves windword processes

    SpamProof, Feb 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    383
    SpamProof
    Feb 25, 2004
  3. milesd
    Replies:
    0
    Views:
    615
    milesd
    Jun 14, 2005
  4. E. Robert Tisdale

    Eats, Shoots & Leaves

    E. Robert Tisdale, Jun 5, 2004, in forum: C Programming
    Replies:
    15
    Views:
    1,314
    Thomas Matthews
    Jun 7, 2004
  5. Dave
    Replies:
    3
    Views:
    362
Loading...

Share This Page