B
Bastian
hello,
when running the follwoing code, i get a error message from
SimpleHttpConnectionManager.releaseConnection:
WARNING: SimpleHttpConnectionManager being used incorrectly. Be sure
that HttpMethod.releaseConnection() ist always called and that only one
thread and/or method is this connection manager at a time.
And it throws java.lang.OutOfMemoryError
This happend only if try to upload bigger files (prob > 50MB) smaller
textfiles are no proplem with this code.
What can i do to solve that problem and what is the problem in detail?
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;
}
long start = 0, time = 0, bytes = local.length();
try {
// Execute the method.
start = System.currentTimeMillis();
int statusCode =
httpclient.executeMethod(method2);
time = System.currentTimeMillis() - start;
if (statusCode != HttpStatus.SC_CREATED
&& statusCode !=
HttpStatus.SC_OK) {
log.warning("PutMethod failed: " +
method2.getStatusLine() + " Statuscode="+statusCode);
} else
ret = true;
} catch (HttpException e) {
log.severe("Fatal protocol violation: " +
e.getMessage());
e.printStackTrace();
} catch (IOException e) {
log.severe("Fatal transport error: " +
e.getMessage());
e.printStackTrace();
} finally {
// Release the connection.
method2.releaseConnection();
}
when running the follwoing code, i get a error message from
SimpleHttpConnectionManager.releaseConnection:
WARNING: SimpleHttpConnectionManager being used incorrectly. Be sure
that HttpMethod.releaseConnection() ist always called and that only one
thread and/or method is this connection manager at a time.
And it throws java.lang.OutOfMemoryError
This happend only if try to upload bigger files (prob > 50MB) smaller
textfiles are no proplem with this code.
What can i do to solve that problem and what is the problem in detail?
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;
}
long start = 0, time = 0, bytes = local.length();
try {
// Execute the method.
start = System.currentTimeMillis();
int statusCode =
httpclient.executeMethod(method2);
time = System.currentTimeMillis() - start;
if (statusCode != HttpStatus.SC_CREATED
&& statusCode !=
HttpStatus.SC_OK) {
log.warning("PutMethod failed: " +
method2.getStatusLine() + " Statuscode="+statusCode);
} else
ret = true;
} catch (HttpException e) {
log.severe("Fatal protocol violation: " +
e.getMessage());
e.printStackTrace();
} catch (IOException e) {
log.severe("Fatal transport error: " +
e.getMessage());
e.printStackTrace();
} finally {
// Release the connection.
method2.releaseConnection();
}