11-06-2010 06:24 AM
private String uploadContent(String dmsInstance, String fileUrl, String strFileName, HttpClient client,
ResponseHandler<String> responseHandler) throws MalformedURLException, ClientProtocolException,
IOException {
log.info("start call to AlfrescoUploadContent.uploadContent");
String strTicket = AuthenticationUtils.getTicket();
log.info("dmsInstance for upload: " + dmsInstance);
if (dmsInstance == null || dmsInstance.equalsIgnoreCase("")) {
throw new IllegalStateException(
"No value was provided for dmsInstance. "
+ "Target host must not be null, or set in parameters. Sample value is http://hostname:port/alfresco/upload");
}
StringBuffer strBuffUploadUrl = new StringBuffer(dmsInstance);
strBuffUploadUrl.append("/").append(strFileName);
strBuffUploadUrl.append("?ticket=");
strBuffUploadUrl.append(strTicket);
URL url = null;
InputStream is = null;
String responseBody = null;
try {
String strUploadUrl = strBuffUploadUrl.toString();
log.info("strUploadUrl: " + strUploadUrl);
HttpPut putFile = new HttpPut(strUploadUrl);
log.debug("creating URL object from fileUrl: " + fileUrl);
url = new URL(fileUrl);
is = url.openStream();
log.debug("available bytes from inputstream: " + is.available());
InputStreamEntity ise = new InputStreamEntity(is, -1);
putFile.setEntity(ise);
responseBody = client.execute(putFile, responseHandler);
log.info("responseBody: " + responseBody);
} catch (MalformedURLException e) {
log.error("MalformedURLException!", e);
throw e;
} catch (ClientProtocolException e) {
log.error("ClientProtocolException!", e);
throw e;
} catch (IOException e) {
log.error("ClientProtocolException!", e);
throw e;
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
log.error("", e);
}
}
}
log.info("done call to AlfrescoUploadContent.uploadContent");
return responseBody;
}
11-06-2010 10:54 AM
11-06-2010 01:24 PM
You may need tune alfresco and in particular increase the number of http threads and database connections available.
What application server are you using?
11-07-2010 04:31 PM
11-07-2010 07:41 PM
Look at the tomcat configuration information. You need to increase the number of HTTP threads.
e.g. http://tomcat.apache.org/tomcat-5.5-doc/config/http.html
A rough rule of thumb is that you need 2 database connections plus a few for luck for each http thread. I think the default is 200.
By the way 40 concurrent uploads is simulating an enormous load. What sort of figures are you expecting for your system in real life?
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.