httpclient executeMethod() leaves early

B

Bastian

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());
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top