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